From e72127a4ec6f91288e9008711215068823100599 Mon Sep 17 00:00:00 2001 From: Timothy Yung Date: Wed, 18 Sep 2024 14:44:55 -0700 Subject: [PATCH] Build `react-dom` in `builds/facebook-fbsource` (#30711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Builds `react-dom` for React Native so that it also populates the `builds/facebook-fbsource` branch. **NOTE:** For Meta employees, D61354219 is the internal integration. ## How did you test this change? ``` $ yarn build … $ ls build/facebook-react-native/react-dom/cjs ReactDOM-dev.js ReactDOM-prod.js ReactDOM-profiling.js ``` --- .../workflows/runtime_commit_artifacts.yml | 1 + scripts/rollup/bundles.js | 48 ++++++++++++++++++- scripts/rollup/packaging.js | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/.github/workflows/runtime_commit_artifacts.yml b/.github/workflows/runtime_commit_artifacts.yml index f47eb3ff360e9..ed0c59caf883e 100644 --- a/.github/workflows/runtime_commit_artifacts.yml +++ b/.github/workflows/runtime_commit_artifacts.yml @@ -125,6 +125,7 @@ jobs: mv build/react-native/shims/ $BASE_FOLDER/react-native-github/Libraries/Renderer/ mv build/facebook-react-native/scheduler/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/scheduler/ mv build/facebook-react-native/react/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/react/ + mv build/facebook-react-native/react/dom/ $BASE_FOLDER/RKJSModules/vendor/react/react-dom/ mv build/facebook-react-native/react-is/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/react-is/ mv build/facebook-react-native/react-test-renderer/cjs/ $BASE_FOLDER/RKJSModules/vendor/react/react-test-renderer/ diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 081b91b9d0b80..26a88fb00811d 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -183,6 +183,7 @@ const bundles = [ wrapWithModuleBoundaries: true, externals: ['react'], }, + /******* React DOM Client *******/ { bundleTypes: [NODE_DEV, NODE_PROD], @@ -204,7 +205,8 @@ const bundles = [ wrapWithModuleBoundaries: true, externals: ['react', 'react-dom'], }, - /******* React DOM FB *******/ + + /******* React DOM (www) *******/ { bundleTypes: [FB_WWW_DEV, FB_WWW_PROD, FB_WWW_PROFILING], moduleType: RENDERER, @@ -215,6 +217,50 @@ const bundles = [ externals: ['react'], }, + /******* React DOM (fbsource) *******/ + { + bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], + moduleType: RENDERER, + entry: 'react-dom', + global: 'ReactDOM', + minifyWithProdErrorCodes: true, + wrapWithModuleBoundaries: false, + externals: ['react', 'ReactNativeInternalFeatureFlags'], + }, + + /******* React DOM Client (fbsource) *******/ + { + bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], + moduleType: RENDERER, + entry: 'react-dom/client', + global: 'ReactDOMClient', + minifyWithProdErrorCodes: true, + wrapWithModuleBoundaries: false, + externals: ['react', 'react-dom', 'ReactNativeInternalFeatureFlags'], + }, + + /******* React DOM Profiling (fbsource) *******/ + { + bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], + moduleType: RENDERER, + entry: 'react-dom/profiling', + global: 'ReactDOMProfiling', + minifyWithProdErrorCodes: true, + wrapWithModuleBoundaries: true, + externals: ['react', 'react-dom', 'ReactNativeInternalFeatureFlags'], + }, + + /******* React DOM Test Utils (fbsource) *******/ + { + moduleType: RENDERER_UTILS, + bundleTypes: [RN_FB_DEV, RN_FB_PROD, RN_FB_PROFILING], + entry: 'react-dom/test-utils', + global: 'ReactDOMTestUtils', + minifyWithProdErrorCodes: false, + wrapWithModuleBoundaries: false, + externals: ['react', 'react-dom', 'ReactNativeInternalFeatureFlags'], + }, + /******* React DOM React Server *******/ { bundleTypes: [NODE_DEV, NODE_PROD], diff --git a/scripts/rollup/packaging.js b/scripts/rollup/packaging.js index 7c433fc2dd330..bc83cb8789eb8 100644 --- a/scripts/rollup/packaging.js +++ b/scripts/rollup/packaging.js @@ -76,6 +76,7 @@ function getBundleOutputPath(bundle, bundleType, filename, packageName) { switch (packageName) { case 'scheduler': case 'react': + case 'react-dom': case 'react-is': case 'react-test-renderer': return `build/facebook-react-native/${packageName}/cjs/${filename}`;