Skip to content

Commit 857ee8c

Browse files
authoredApr 20, 2024··
Don't minify symbols in production builds (#28881)
This disables symbol renaming in production builds. The original variable and function names are preserved. All other forms of compression applied by Closure (dead code elimination, inlining, etc) are unchanged — the final program is identical to what we were producing before, just in a more readable form. The motivation is to make it easier to debug React issues that only occur in production — the same reason we decided to start shipping sourcemaps in #28827 and #28827. However, because most apps run their own minification step on their npm dependencies, it's not necessary for us to minify the symbols before publishing — it'll be handled the app, if desired. This is the same strategy Meta has used to ship React for years. The React build itself has unminified symbols, but they get minified as part of Meta's regular build pipeline. Even if an app does not minify their npm dependencies, gzip covers most of the cost of symbol renaming anyway. This saves us from having to ship sourcemaps, which means even apps that don't have sourcemaps configured will be able to debug the React build as easily as they would any other npm dependency.
1 parent ea26e38 commit 857ee8c

File tree

83 files changed

+101
-259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+101
-259
lines changed
 

‎dangerfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ const SIGNIFICANCE_THRESHOLD = 0.002;
4343
const CRITICAL_ARTIFACT_PATHS = new Set([
4444
// We always report changes to these bundles, even if the change is
4545
// insignificant or non-existent.
46-
'oss-stable/react-dom/cjs/react-dom.production.min.js',
47-
'oss-experimental/react-dom/cjs/react-dom.production.min.js',
46+
'oss-stable/react-dom/cjs/react-dom.production.js',
47+
'oss-experimental/react-dom/cjs/react-dom.production.js',
4848
'facebook-www/ReactDOM-prod.classic.js',
4949
'facebook-www/ReactDOM-prod.modern.js',
5050
]);

‎package.json

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
"shelljs": "^0.8.5",
9595
"signedsource": "^2.0.0",
9696
"targz": "^1.0.1",
97-
"terser": "^5.30.3",
9897
"through2": "^3.0.1",
9998
"tmp": "^0.1.0",
10099
"typescript": "^3.7.5",

0 commit comments

Comments
 (0)
Please sign in to comment.