We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
inconsistentCjsInterop: true
1 parent abc49a3 commit 38a8609Copy full SHA for 38a8609
packages/vite/src/node/plugins/importAnalysis.ts
@@ -948,11 +948,12 @@ export function interopNamedImports(
948
} = importSpecifier
949
const exp = source.slice(expStart, expEnd)
950
if (dynamicIndex > -1) {
951
+ const inconsistentCjsInterop = !!config.legacy?.inconsistentCjsInterop
952
// rewrite `import('package')` to expose the default directly
953
str.overwrite(
954
expStart,
955
expEnd,
- `import('${rewrittenUrl}').then(m => (${interopHelperStr})(m.default, 1))` +
956
+ `import('${rewrittenUrl}').then(m => (${interopHelperStr})(m.default, ${inconsistentCjsInterop ? 0 : 1}))` +
957
getLineBreaks(exp),
958
{ contentOnly: true },
959
)
0 commit comments