Replies: 3 comments 17 replies
-
I'm importing some packages such as vite.ssrLoadModule("...") [Module: null prototype] {
__esModule: true,
default: { default: [Function: Slider] }
} How to fix this without enabling this option? |
Beta Was this translation helpful? Give feedback.
-
In case this feedback is helpful; That I could experience, the ecosystem's state for node.js likely does not fit this removal well.
So a few key points come to mind: ESM without interop may be unrealistic For any server project of a decent size, the task of writing strict ESM (without interop) may be too error-prone and require too much maintenance to be viable because of historical node.js and typescript decisions. Providing interop support would match browser builds: That's solution 1 (Make prod match dev behaviour). Although I understand supporting externalized dependencies may carry different challenges, the final dev experience would be more consistent for Vite users across browser and ssr builds. CJS builds need legacy.proxySsrExternalModules Projects that still compile to CJS (as I suspect may be common for node.js projects) were not affected by this dev vs prod discrepancy and using By CJS builds, I mean this:
|
Beta Was this translation helpful? Give feedback.
-
I don't understand why Vite can't do this transformation |
Beta Was this translation helpful? Give feedback.
-
legacy.proxySsrExternalModules
If you have concerns, questions, or bug reports as to why you still need this option, please leave a comment here!
Notes
This comment brought up that this option is still useful when outputting as CJS. In a CJS build, Rollup is able to bundle named imports of externalized CJS packages to something that works in a CJS runtime.
Our dev runtime usually don't take in account of build-related settings, and unfortunately we had removed
ssr.format: 'cjs'
that would've allowed us to avoid checking build-related settings, but I think this may be an exception for now to get CJS somewhat working.Beta Was this translation helpful? Give feedback.
All reactions