You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project is fully ESM, none of the problems exist listed above exist.
When installing dependencies with yarn (tested 3.6.3 and 4.9.2) it does crash because of cjs import used (ERR_REQUIRE_ESM). Seems like some yarn issue, since it does not crash when npm install (+pnpm)
This happens using the default template.
vite.config.ts: Removing reactRouter() plugin (from: @react-router/dev/vite) voids the warning under pnpm.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Using:
node 22 (same with 20)
made all the different install methods and package managers "clean" by removing all caches, locks and node_modules in between.
pnpm dev (= react-router dev) triggers the warning, but works:
The project is fully ESM, none of the problems exist listed above exist.
When installing dependencies with yarn (tested 3.6.3 and 4.9.2) it does crash because of cjs import used (ERR_REQUIRE_ESM). Seems like some yarn issue, since it does not crash when npm install (+pnpm)
This happens using the default template.
vite.config.ts: Removing reactRouter() plugin (from:
@react-router/dev/vite
) voids the warning under pnpm.Running
VITE_CJS_TRACE=true pnpm vite
Reveals everything was run initially as ESM correctly, but at:
@[email protected]_@[email protected][email protected][email protected]_r_927aab58496416c928f923b6f5ef2a18/node_modules/@react-router/dev/dist/vite.js
Which uses commonjs syntax. Any imports afterwards "forked" to the cjs options, next after is:
[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vite-node/dist/server.cjs
The switching to .cjs happens in
@react-router/dev/vite
I use now pnpm anyway, so its just warning for me, but was surprised of that result out of the box.
Is the plugin still cjs or is there some package.json missconfiguration that switches to cjs?
Beta Was this translation helpful? Give feedback.
All reactions