Fix remaining CommonJS imports after Rollup upgrade (#26473)
Follow-up to https://github.com/facebook/react/pull/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.
dan committed
Mar 25, 2023 at 00:05 UTC
175962c10c53e5adfcfc02a3d6cc3f487d5a78a0
1 file changed
+6
-2
scripts/rollup/build.js
+6
-2
@@ -182,12 +182,16 @@ let getRollupInteropValue = id => {
182
// Specifying `interop: 'default'` instead will have Rollup use the imported variable as-is,
183
// without adding a `.default` to the reference.
184
const modulesWithCommonJsExports = [
185
- 'JSResourceReferenceImpl',
186
- 'error-stack-parser',
185
'art/core/transform',
186
'art/modes/current',
187
'art/modes/fast-noSideEffects',
188
'art/modes/svg',
189
+ 'JSResourceReferenceImpl',
190
+ 'error-stack-parser',
191
+ 'neo-async',
192
+ 'webpack/lib/dependencies/ModuleDependency',
193
+ 'webpack/lib/dependencies/NullDependency',
194
+ 'webpack/lib/Template',
195
];
196
197
if (modulesWithCommonJsExports.includes(id)) {