From 175962c10c53e5adfcfc02a3d6cc3f487d5a78a0 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 25 Mar 2023 00:05:23 +0000 Subject: [PATCH] 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. --- scripts/rollup/build.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index f7ce2760fb7bf..6e6384aba66f8 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -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)) {