Next 14: Specified module format (CommonJs) is not matching the module format of the source code (EcmaScript Modules) #2579
Replies: 12 comments 28 replies
-
Hm, I've never seen such an error message. Would you be able to create a reproduction with StackBlitz? |
Beta Was this translation helpful? Give feedback.
-
Same here! @dominik-sfl are you using turbo? |
Beta Was this translation helpful? Give feedback.
-
I got the same error using turbo. @dominik-sfl @danimrangelb Has anyone solved this issue? |
Beta Was this translation helpful? Give feedback.
-
We got the same error when upgrading from Kind of big project, but most of the dependencies are at the latest. Some notable deps:
Happy to answer any questions. |
Beta Was this translation helpful? Give feedback.
-
I made a draft PR to remove the type field in package.json, but we don't plan to merge it as of now: #2626 |
Beta Was this translation helpful? Give feedback.
-
I was able to edit out Doing this fixed it. |
Beta Was this translation helpful? Give feedback.
-
Just for anyone googling, just ran into this with next |
Beta Was this translation helpful? Give feedback.
-
Also ran into same issue spinning up a new Next.js 15.0.2 using Turbo in dev mode. |
Beta Was this translation helpful? Give feedback.
-
To fix this using pnpm: Prepare for patching: pnpm patch jotai Open package.json: open node_modules/.pnpm_patches/[email protected]/package.json Remove this line (L5): {
"name": "jotai",
"description": "👻 Primitive and flexible state management for React",
"private": false,
- "type": "commonjs",
"version": "2.10.1",
"main": "./index.js", Path this commit: pnpm patch-commit 'node_modules/.pnpm_patches/[email protected]' Now it should work though I don't know why. |
Beta Was this translation helpful? Give feedback.
-
That happens when you are using jotai in SSR, make sure put |
Beta Was this translation helpful? Give feedback.
-
The only thing that helped me was using dynamic loading without ssr, which guarantees full operation on the client |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, Just a quick update: this issue has been fixed in Next.js 15.1.4. No more workarounds or patches are needed. Details here: Next.js PR #74608. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my newly installed next.js app (14.2.3), using
create-t3-app
, I get the following error when I import jotai's Provider & wrap it around its children:Simply by doing this:
TS Config (default t3 tsconfig)
Anyone know what's going on here? :/
Beta Was this translation helpful? Give feedback.
All reactions