From 517d2146702d5d69a58536d5b9c1d61c510b3c1d Mon Sep 17 00:00:00 2001 From: kassens Date: Fri, 1 Dec 2023 19:42:52 +0000 Subject: [PATCH] Add sideEffects flag to react-is for tree shaking (#27701) ## Summary This PR: - Adds the `"sideEffects": false` flag to the `react-is` package, to enable proper tree-shaking ## How did you test this change? React-Redux v9 beta switches its artifacts from separate JS files to pre-bundled artifacts. While testing builds locally, I noticed that our use of `react-is` was no longer getting tree-shaken from Vite builds, despite `react-is` only being used by our `connect` API and `connect` itself getting shaken out of the final bundle. Hand-adding `"sideEffects": false` to the `react-is` package locally convinced Vite (+Rollup) to properly tree-shake `react-is` out of the bundle when it wasn't being used. I'd love to see this published as v18.2.1 as soon as this PR is merged - we're hoping to release React-Redux v9 in the next few weeks! DiffTrain build for commit https://github.com/facebook/react/commit/108fd8cab015688e6e8e57956c2f1ed1a0c054f2. --- .../vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js | 2 +- .../vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js | 4 ++-- .../react-test-renderer/cjs/ReactTestRenderer-profiling.js | 4 ++-- .../xplat/js/RKJSModules/vendor/react/cjs/React-dev.js | 2 +- .../xplat/js/RKJSModules/vendor/react/cjs/React-prod.js | 2 +- .../xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js | 2 +- .../xplat/js/react-native-github/Libraries/Renderer/REVISION | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index 42ede32ffbd0f..2136aef2099ba 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -25474,7 +25474,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-canary-dc40571b3-20231201"; + var ReactVersion = "18.3.0-canary-108fd8cab-20231201"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index a619f9503b427..792218e941d22 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -9083,7 +9083,7 @@ var devToolsConfig$jscomp$inline_1033 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-dc40571b3-20231201", + version: "18.3.0-canary-108fd8cab-20231201", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1226 = { @@ -9114,7 +9114,7 @@ var internals$jscomp$inline_1226 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-dc40571b3-20231201" + reconcilerVersion: "18.3.0-canary-108fd8cab-20231201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 61f4df935b85e..405674295ccbd 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -9509,7 +9509,7 @@ var devToolsConfig$jscomp$inline_1075 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-dc40571b3-20231201", + version: "18.3.0-canary-108fd8cab-20231201", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1267 = { @@ -9540,7 +9540,7 @@ var internals$jscomp$inline_1267 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-dc40571b3-20231201" + reconcilerVersion: "18.3.0-canary-108fd8cab-20231201" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index 57710ef994c9e..cc13952fb085c 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-canary-dc40571b3-20231201"; + var ReactVersion = "18.3.0-canary-108fd8cab-20231201"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index ab455b43eea2f..d3999a5d482f0 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-dc40571b3-20231201"; +exports.version = "18.3.0-canary-108fd8cab-20231201"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 0a5b51fec81c7..6053b11868dbb 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -576,7 +576,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-dc40571b3-20231201"; +exports.version = "18.3.0-canary-108fd8cab-20231201"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 47d6430818b4d..6eb9714a879f4 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -dc40571b3efd18d4d08fdf6146ad5ec980ea12dd +108fd8cab015688e6e8e57956c2f1ed1a0c054f2