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
Hello, I'm looking at #19036 and wondering if there's anything smaller that I should report, maybe to an upstream project like Rollup, regarding CommonJS interoperability.
For example I noticed that when using ssr.noExternal if a CJS package I installed does the following:
module.exports={foo: require('./foo'),}
The require() call will remain after vite build, which won't work in an ESM project, but if I move it out of the expression:
constfoo=require('./foo')module.exports={ foo }
the ./foo module will get inlined properly. Is this worth reporting to Rollup maybe?
Also, any usage of __dirname and __filename will remain as-is, they won't get converted to import.meta.dirname and import.meta.filename.
Is there some way to know the exact extent and the limitations of Vite's interoperability with CommonJS?
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
-
Hello, I'm looking at #19036 and wondering if there's anything smaller that I should report, maybe to an upstream project like Rollup, regarding CommonJS interoperability.
For example I noticed that when using
ssr.noExternal
if a CJS package I installed does the following:The
require()
call will remain aftervite build
, which won't work in an ESM project, but if I move it out of the expression:the
./foo
module will get inlined properly. Is this worth reporting to Rollup maybe?Also, any usage of
__dirname
and__filename
will remain as-is, they won't get converted toimport.meta.dirname
andimport.meta.filename
.Is there some way to know the exact extent and the limitations of Vite's interoperability with CommonJS?
Beta Was this translation helpful? Give feedback.
All reactions