Skip to content

Commit

Permalink
Fix remaining CommonJS imports after Rollup upgrade (#26473)
Browse files Browse the repository at this point in the history
Follow-up to #26442.

It looks like we missed a few cases where we default import a CommonJS
module, which leads to Rollup adding `.default` access, e.g.
`require('webpack/lib/Template').default` in the output.

To fix, add the remaining cases to the list of exceptions. Verified by
going through all `externals` in the bundle list, and manually checking
the webpack plugin.
  • Loading branch information
gaearon committed Mar 25, 2023
1 parent 3fcf209 commit 175962c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/rollup/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,16 @@ let getRollupInteropValue = id => {
// Specifying `interop: 'default'` instead will have Rollup use the imported variable as-is,
// without adding a `.default` to the reference.
const modulesWithCommonJsExports = [
'JSResourceReferenceImpl',
'error-stack-parser',
'art/core/transform',
'art/modes/current',
'art/modes/fast-noSideEffects',
'art/modes/svg',
'JSResourceReferenceImpl',
'error-stack-parser',
'neo-async',
'webpack/lib/dependencies/ModuleDependency',
'webpack/lib/dependencies/NullDependency',
'webpack/lib/Template',
];

if (modulesWithCommonJsExports.includes(id)) {
Expand Down

0 comments on commit 175962c

Please sign in to comment.