From c2ae9e28bc02fdd29c46b247d908e6b467ef06af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Sat, 8 Jun 2024 11:15:57 -0400 Subject: [PATCH] Minify DEV bundles with closure (#29809) The goal is to improve speed of the development by inlining and DCE unused branches. We have the ability to preserve some variable names and pretty print in the production version so might as well do the same with DEV. --- packages/shared/CheckStringCoercion.js | 1 + scripts/rollup/build.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/shared/CheckStringCoercion.js b/packages/shared/CheckStringCoercion.js index 1a061b6601..a186d6755d 100644 --- a/packages/shared/CheckStringCoercion.js +++ b/packages/shared/CheckStringCoercion.js @@ -43,6 +43,7 @@ function willCoercionThrow(value: mixed): boolean { } } +/** @noinline */ function testStringCoercion(value: mixed) { // If you ended up here by following an exception call stack, here's what's // happened: you supplied an object or symbol value to React (as a prop, key, diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index 2ade58493a..df9fb00b09 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -361,7 +361,8 @@ function getPlugins( const isProduction = isProductionBundleType(bundleType); const isProfiling = isProfilingBundleType(bundleType); - const needsMinifiedByClosure = isProduction && bundleType !== ESM_PROD; + const needsMinifiedByClosure = + bundleType !== ESM_PROD && bundleType !== ESM_DEV; return [ // Keep dynamic imports as externals