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

This commit is contained in:
Sebastian "Sebbie" Silbermann 2025-08-25 09:39:56 +02:00 committed by GitHub
parent 090777d78a
commit 9eede45646
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 56 additions and 16 deletions

View File

@ -144,7 +144,6 @@ function getBabelConfig(
updateBabelOptions,
bundleType,
packageName,
externals,
isDevelopment,
bundle
) {
@ -354,7 +353,6 @@ function forbidFBJSImports() {
function getPlugins(
entry,
externals,
updateBabelOptions,
filename,
packageName,
@ -402,8 +400,8 @@ function getPlugins(
forbidFBJSImports(),
// Use Node resolution mechanism.
resolve({
// skip: externals, // TODO: options.skip was removed in @rollup/plugin-node-resolve 3.0.0
preferBuiltins: bundle.preferBuiltins,
// `external` rollup config takes care of marking builtins as externals
preferBuiltins: false,
}),
// Remove license headers from individual modules
stripBanner({
@ -415,7 +413,6 @@ function getPlugins(
updateBabelOptions,
bundleType,
packageName,
externals,
!isProduction,
bundle
)
@ -690,7 +687,6 @@ async function createBundle(bundle, bundleType) {
onwarn: handleRollupWarning,
plugins: getPlugins(
bundle.entry,
externals,
bundle.babel,
filename,
packageName,

View File

@ -363,7 +363,14 @@ const bundles = [
global: 'ReactDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
externals: [
'react',
'react-dom',
'async_hooks',
'crypto',
'stream',
'util',
],
},
{
bundleTypes: __EXPERIMENTAL__ ? [FB_WWW_DEV, FB_WWW_PROD] : [],
@ -460,7 +467,14 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
externals: [
'react',
'react-dom',
'async_hooks',
'crypto',
'stream',
'util',
],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
@ -472,7 +486,14 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
externals: [
'react',
'react-dom',
'async_hooks',
'crypto',
'stream',
'util',
],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
@ -483,7 +504,7 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
externals: ['react'],
},
/******* React Server DOM Webpack Client *******/
@ -588,7 +609,14 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'async_hooks', 'react-dom'],
externals: [
'react',
'react-dom',
'async_hooks',
'crypto',
'stream',
'util',
],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
@ -599,7 +627,7 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'async_hooks', 'react-dom'],
externals: ['react'],
},
/******* React Server DOM Turbopack Client *******/
@ -656,7 +684,14 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'async_hooks', 'react-dom'],
externals: [
'react',
'react-dom',
'async_hooks',
'crypto',
'stream',
'util',
],
},
{
bundleTypes: [NODE_DEV, NODE_PROD],
@ -667,7 +702,7 @@ const bundles = [
global: 'ReactServerDOMServer',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'async_hooks', 'react-dom'],
externals: ['react', 'react-dom'],
},
/******* React Server DOM Parcel Client *******/
@ -711,7 +746,14 @@ const bundles = [
condition: 'react-server',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'util', 'crypto', 'async_hooks', 'react-dom'],
externals: [
'react',
'react-dom',
'async_hooks',
'crypto',
'stream',
'util',
],
},
/******* React Server DOM ESM Client *******/
@ -729,7 +771,7 @@ const bundles = [
entry: 'react-server-dom-esm/client.node',
minifyWithProdErrorCodes: false,
wrapWithModuleBoundaries: false,
externals: ['react', 'react-dom', 'util', 'crypto'],
externals: ['react', 'react-dom', 'util'],
},
/******* React Server DOM ESM Node.js Loader *******/
@ -1215,6 +1257,8 @@ const bundles = [
'hermes-parser',
'zod',
'zod-validation-error',
'crypto',
'util',
],
tsconfig: './packages/eslint-plugin-react-hooks/tsconfig.json',
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`,