-
-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES Modules / CommonJS error in next.js 14.2.5 #2310
Comments
@TheMikeyRoss interesting, thanks for the report. How do I reproduce this? |
Yes,
I will try to make a stackblitz reproduction |
Stackblitz Reproductionhttps://stackblitz.com/edit/nextjs-8bsfgq?file=pages%2Findex.js |
Not sure if it's the way or if it's the pacakge.json of |
A workaround there could be to use I am not sure why cjs is not working there, I'll try to fix it. |
I just tried that but unfortunately we're still getting the same error |
I downgraded |
Thanks @zaaakher for the follow--back. This with CJS vs ESM is actually an issue I have since long when publishing on npm. Somebody could give a look to what is wrong in the package.json? I'm out of ideas and I can't setup reproducible cases for the issue.
|
One other idea here: add a {
"type": "commonjs"
} and Node / bundlers will then use the CommonJS module loader to read the files. https://webpack.js.org/guides/ecma-script-modules/#flagging-modules-as-esm |
@gpbl is it published to npm? in 9.0.0-rc.6 ? |
Thanks @strmer15! The fix - touching a package.json in dist/cjs - should work also for @TheMikeyRoss @zaaakher v9.0.6 should be published including the fix. Hopefully it works: I appreciate your feedback, thanks. |
I have react-day-picker component in my next.js app and it used to work perfectly but after updating to v9 now im getting this critical error.
if I add type=module in my package.json of my next.js app everything breaks and I have to change things in next.config and i18n.js and dozen other files, and after going through all of that it caused more errors that I could solve.
I'm I doing something wrong?
The text was updated successfully, but these errors were encountered: