@samitouri / QOS-React / commits / 9eede45646

Stop treating all Node.js builtins implicitly as externals (#34249)

Sebastian "Sebbie" Silbermann committed Aug 25, 2025 at 09:39 UTC 9eede45646457fcf06261badc6c1a0c7afe1e144
2 files changed +56 -16
scripts/rollup/build.js
+2 -6
@@ -144,7 +144,6 @@ function getBabelConfig(
144 updateBabelOptions,
145 bundleType,
146 packageName,
147 - externals,
147 isDevelopment,
148 bundle
149 ) {
@@ -354,7 +353,6 @@ function forbidFBJSImports() {
353
354 function getPlugins(
355 entry,
357 - externals,
356 updateBabelOptions,
357 filename,
358 packageName,
@@ -402,8 +400,8 @@ function getPlugins(
400 forbidFBJSImports(),
401 // Use Node resolution mechanism.
402 resolve({
405 - // skip: externals, // TODO: options.skip was removed in @rollup/plugin-node-resolve 3.0.0
406 - preferBuiltins: bundle.preferBuiltins,
403 + // `external` rollup config takes care of marking builtins as externals
404 + preferBuiltins: false,
405 }),
406 // Remove license headers from individual modules
407 stripBanner({
@@ -415,7 +413,6 @@ function getPlugins(
413 updateBabelOptions,
414 bundleType,
415 packageName,
418 - externals,
416 !isProduction,
417 bundle
418 )
@@ -690,7 +687,6 @@ async function createBundle(bundle, bundleType) {
687 onwarn: handleRollupWarning,
688 plugins: getPlugins(
689 bundle.entry,
693 - externals,
690 bundle.babel,
691 filename,
692 packageName,
scripts/rollup/bundles.js
+54 -10
@@ -363,7 +363,14 @@ const bundles = [
363 global: 'ReactDOMServer',
364 minifyWithProdErrorCodes: false,
365 wrapWithModuleBoundaries: false,
366 - externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
366 + externals: [
367 + 'react',
368 + 'react-dom',
369 + 'async_hooks',
370 + 'crypto',
371 + 'stream',
372 + 'util',
373 + ],
374 },
375 {
376 bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
@@ -460,7 +467,14 @@ const bundles = [
467 global: 'ReactServerDOMServer',
468 minifyWithProdErrorCodes: false,
469 wrapWithModuleBoundaries: false,
463 - externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
470 + externals: [
471 + 'react',
472 + 'react-dom',
473 + 'async_hooks',
474 + 'crypto',
475 + 'stream',
476 + 'util',
477 + ],
478 },
479 {
480 bundleTypes: [NODE_DEV, NODE_PROD],
@@ -472,7 +486,14 @@ const bundles = [
486 global: 'ReactServerDOMServer',
487 minifyWithProdErrorCodes: false,
488 wrapWithModuleBoundaries: false,
475 - externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
489 + externals: [
490 + 'react',
491 + 'react-dom',
492 + 'async_hooks',
493 + 'crypto',
494 + 'stream',
495 + 'util',
496 + ],
497 },
498 {
499 bundleTypes: [NODE_DEV, NODE_PROD],
@@ -483,7 +504,7 @@ const bundles = [
504 global: 'ReactServerDOMServer',
505 minifyWithProdErrorCodes: false,
506 wrapWithModuleBoundaries: false,
486 - externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
507 + externals: ['react'],
508 },
509
510 /******* React Server DOM Webpack Client *******/
@@ -588,7 +609,14 @@ const bundles = [
609 global: 'ReactServerDOMServer',
610 minifyWithProdErrorCodes: false,
611 wrapWithModuleBoundaries: false,
591 - externals: ['react', 'util', 'async_hooks', 'react-dom'],
612 + externals: [
613 + 'react',
614 + 'react-dom',
615 + 'async_hooks',
616 + 'crypto',
617 + 'stream',
618 + 'util',
619 + ],
620 },
621 {
622 bundleTypes: [NODE_DEV, NODE_PROD],
@@ -599,7 +627,7 @@ const bundles = [
627 global: 'ReactServerDOMServer',
628 minifyWithProdErrorCodes: false,
629 wrapWithModuleBoundaries: false,
602 - externals: ['react', 'util', 'async_hooks', 'react-dom'],
630 + externals: ['react'],
631 },
632
633 /******* React Server DOM Turbopack Client *******/
@@ -656,7 +684,14 @@ const bundles = [
684 global: 'ReactServerDOMServer',
685 minifyWithProdErrorCodes: false,
686 wrapWithModuleBoundaries: false,
659 - externals: ['react', 'util', 'async_hooks', 'react-dom'],
687 + externals: [
688 + 'react',
689 + 'react-dom',
690 + 'async_hooks',
691 + 'crypto',
692 + 'stream',
693 + 'util',
694 + ],
695 },
696 {
697 bundleTypes: [NODE_DEV, NODE_PROD],
@@ -667,7 +702,7 @@ const bundles = [
702 global: 'ReactServerDOMServer',
703 minifyWithProdErrorCodes: false,
704 wrapWithModuleBoundaries: false,
670 - externals: ['react', 'util', 'async_hooks', 'react-dom'],
705 + externals: ['react', 'react-dom'],
706 },
707
708 /******* React Server DOM Parcel Client *******/
@@ -711,7 +746,14 @@ const bundles = [
746 condition: 'react-server',
747 minifyWithProdErrorCodes: false,
748 wrapWithModuleBoundaries: false,
714 - externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
749 + externals: [
750 + 'react',
751 + 'react-dom',
752 + 'async_hooks',
753 + 'crypto',
754 + 'stream',
755 + 'util',
756 + ],
757 },
758
759 /******* React Server DOM ESM Client *******/
@@ -729,7 +771,7 @@ const bundles = [
771 entry: 'react-server-dom-esm/client.node',
772 minifyWithProdErrorCodes: false,
773 wrapWithModuleBoundaries: false,
732 - externals: ['react', 'react-dom', 'util', 'crypto'],
774 + externals: ['react', 'react-dom', 'util'],
775 },
776
777 /******* React Server DOM ESM Node.js Loader *******/
@@ -1215,6 +1257,8 @@ const bundles = [
1257 'hermes-parser',
1258 'zod',
1259 'zod-validation-error',
1260 + 'crypto',
1261 + 'util',
1262 ],
1263 tsconfig: './packages/eslint-plugin-react-hooks/tsconfig.json',
1264 prebuild: `mkdir -p ./compiler/packages/babel-plugin-react-compiler/dist && echo "module.exports = require('../src/index.ts');" > ./compiler/packages/babel-plugin-react-compiler/dist/index.js`,