Build error with Next.js when using this library
la55u opened this issue · 4 comments
la55u commented
> Build error occurred
/usr/app/node_modules/@n8tb1t/use-scroll-position/lib/index.js:1
export { useScrollPosition } from './useScrollPosition';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1116:16)
at Module._compile (internal/modules/cjs/loader.js:1164:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.Mgi6 (/usr/app/.next/server/pages/[lng]/events.js:786:18)
at __webpack_require__ (/usr/app/.next/server/pages/[lng]/events.js:29:31)
at Module.qO+a (/usr/app/.next/server/pages/[lng]/events.js:2762:28) {
type: 'SyntaxError'
}
npm ERR! code
ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.1.0 build: `next build`
npm
Any suggestions? thank you
Npm v6.14.6
Next.js v9.5.2
cefjic commented
Details:
usr/app/node_modules/@n8tb1t/use-scroll-position/lib/index.js:1
export { useScrollPosition } from './useScrollPosition';
^^^^^^
SyntaxError: Unexpected token 'export'
at compileFunction (<anonymous>)
2 | import { useTranslation } from 'react-i18next';
3 |
> 4 | import { useScrollPosition } from '@n8tb1t/use-scroll-position';
| ^
5 | import { Button, Subtitle } from '@proprioo/salatim';
6 |
7 | import Calendar from '../../../assets/icons/calendar.svg';
at Runtime._execModule (node_modules/jest-runtime/build/index.js:1179:56)
at Object.<anonymous> (src/components/listing/listingSideBar/WrapperSideBar.tsx:4:1)
at Object.<anonymous> (src/components/listing/listingSideBar/ListingSideBar.tsx:15:1)
at src/components/listing/listingDetails/ListingDetails.tsx:101:3
Same problem on my unit tests. There is no error on v1.0.43.
Yarn v1.21.1
Next.js v9.5.3
la55u commented
Same problem on my unit tests. There is no error on v1.0.43.
Yarn v1.21.1
Next.js v9.5.3
same here, downgraded to that version and it works for now
n8tb1t commented
Thanks for the report! Please try the v1.0.47 and let me know if it works?
cefjic commented
Hello ! It's works for me, thanks you ;)