File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
packages/react-server-dom-webpack Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 6666 "./server.node.unbundled" : " ./server.node.unbundled.js" ,
6767 "./node-loader" : " ./esm/react-server-dom-webpack-node-loader.production.min.js" ,
6868 "./node-register" : " ./node-register.js" ,
69- "./src/*" : " ./src/*" ,
69+ "./src/*" : " ./src/*.js " ,
7070 "./package.json" : " ./package.json"
7171 },
7272 "main" : " index.js" ,
Original file line number Diff line number Diff line change @@ -173,6 +173,30 @@ function getBabelConfig(
173173 return options ;
174174}
175175
176+ let getRollupInteropValue = id => {
177+ // ReactNoop.js and ReactNoopPersistent.js use several default imports from other internal packages.
178+ // That gets turned into a `require()`, but the `module.exports = function reconciler()` wrapper
179+ // gets added later, so Rollup isn't fully aware of it, and tries to use `RFR.default` instead.
180+ // Force Rollup to use the `require()`'d value directly, without adding a `.default`.
181+ // Other cases:
182+ // - `react-art` needs to deal with imports from the `art` package
183+ // -`error-stack-parser`
184+ const exactModuleNames = [
185+ 'react-reconciler' ,
186+ 'react-server/flight' ,
187+ 'react-client/flight' ,
188+ 'react-server' ,
189+ 'error-stack-parser' ,
190+ ] ;
191+
192+ if ( exactModuleNames . includes ( id ) || id . startsWith ( 'art/' ) ) {
193+ return 'default' ;
194+ }
195+
196+ // For all other modules, handle imports without any import helper utils
197+ return 'esModule' ;
198+ } ;
199+
176200function getRollupOutputOptions (
177201 outputPath ,
178202 format ,
@@ -187,7 +211,7 @@ function getRollupOutputOptions(
187211 format,
188212 globals,
189213 freeze : ! isProduction ,
190- interop : false ,
214+ interop : getRollupInteropValue ,
191215 name : globalName ,
192216 sourcemap : false ,
193217 esModule : false ,
@@ -612,7 +636,7 @@ async function createBundle(bundle, bundleType) {
612636 output : {
613637 externalLiveBindings : false ,
614638 freeze : false ,
615- interop : false ,
639+ interop : getRollupInteropValue ,
616640 esModule : false ,
617641 } ,
618642 } ;
Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ const bundles = [
442442 {
443443 bundleTypes : [ NODE_ES2015 ] ,
444444 moduleType : RENDERER_UTILS ,
445- entry : 'react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js ' ,
445+ entry : 'react-server-dom-webpack/src/ReactFlightWebpackNodeRegister' ,
446446 name : 'react-server-dom-webpack-node-register' ,
447447 global : 'ReactFlightWebpackNodeRegister' ,
448448 minifyWithProdErrorCodes : false ,
You can’t perform that action at this time.
0 commit comments