-
Notifications
You must be signed in to change notification settings - Fork 697
Closed
Copy link
Description
Description
When using dynamic import with CJS output format, the runtime helper functions (like __commonJSMin) are not properly injected into the dynamically imported chunks. Instead, the generated code incorrectly tries to import them from the entry chunk.
Reproduction
// index.js
import("./a.ts").then((m) => console.log(m.default));
// a.ts
module.exports = {
value: 42,
hello: 'world',
}Actual Output
The dynamically imported chunk a-DKX7L-vB.js incorrectly generates:
const require_index = require('./index.js');
var require_a = /* @__PURE__ */ require_index.__commonJSMin(((exports, module) => {
// ...
}));The output tries to access __commonJSMin from the entry chunk via require('./index.js').__commonJSMin, which doesn't work because index.js doesn't export the runtime helpers.
Expected Behavior
The runtime helper __commonJSMin should be export.
Reactions are currently unavailable