Open SaadBazaz opened 1 year ago
I got the same error as well. Have you been able to get a solution yet?
I got the same error as well. Have you been able to get a solution yet?
I started using the react-parallax-tilt library instead.
im having the same issue
Same issue
Yeah it looks like tsup
/ TypeScript has been incorrectly configured in #23 - not only a problem with Next.js - it indicates a problem generally for the types, including a conflict between:
"type": "module"
in package.json
or anything else to make this package ESMimport
keyword therecc @jonathandion
Check out the Are The Types Wrong? page for react-tilt
Error message:
The implementation resolved at the package uses ESM syntax, but the detected module kind is CJS. This will be an error in Node (and potentially other runtimes and bundlers). The module kind was decided based on the nearest package.json’s lack of a "type": "module" field.
@jonathandion since it looks like you want to publish CommonJS instead of ESM (unless you're ready to switch your package to ESM), changing the target
in your tsconfig.json
to "CommonJS"
would be one option.
Opened a PR here:
I was able to successfully implement this using the next@13.4.1-canary.1
version and the App Router in the app/
directory. In case you'd like to see a small reproduction project, I've created one on CodeSandbox
I encountered the error SyntaxError: Cannot use import statement outside a module
while using the pages/
directory in Next.js. I've created a small reproduction project on CodeSandbox to showcase the issue
I added transpilePackages: ["react-tilt"]
to my next.config.js
to get this to work.
I get the following error on fresh install and importing it in a NextJS page:
SyntaxError: Cannot use import statement outside a module
My import code:
Environment: "next": "13.1.1", "react": "18.2.0", "react-dom": "18.2.0",