New setting `cjsInterop`
brillout opened this issue · comments
Rom commented
Description
// vike.config.js
export default {
fixNpmPackages: ['some-npm-package']
}
Vike would then:
- If
some-npm-package
is CJS add it to https://github.com/cyco130/vite-plugin-cjs-interop. - Otherwise, add it to
ssr.noExternal
. - Show a warning saying that "Please reach out to the
some-npm-package
maintainer with a reproduction".
TODO: Vite currently fails when adding a CJS package to ssr.noExternal
, check whether Vite has plans to support executing CJS server-side code.
Edit: a new config cjsInterop
would probably be better. Setting it to true
would automatically apply it (by dynamically checking whether a package is CJS).