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
{{ message }}
Repository navigation
CJS output: (await import("./x")).default is the exports object instead of the default export #577
With rollup.emitCJS: true, a dynamic import of a local module is preserved as import('./chunks/plugin.cjs') in dist/index.cjs, while dist/chunks/plugin.cjs sets exports.default = plugin. Because Node.js exposes module.exports as default when import() loads a CommonJS file (https://nodejs.org/api/esm.html#commonjs-namespaces), mod.default resolves to { default: [Function: plugin] } instead of the function itself.
Additional context
This happens because the preserveDynamicImports plugin (enabled by default) also rewrites dynamic imports of internal chunks; without it, Rollup emits Promise.resolve().then(() => require('./chunks/plugin.cjs')), where .default is the function.
Activity