Skip to content

Commit

Permalink
Run Closure on non-minified prod builds, too (#28827)
Browse files Browse the repository at this point in the history
In #26446 we started publishing non-minified versions of our production
build artifacts, along with source maps, for easier debugging of React
when running in production mode.

The way it's currently set up is that these builds are generated
*before* Closure compiler has run. Which means it's missing many of the
optimizations that are in the final build, like dead code elimination.

This PR changes the build process to run Closure on the non-minified
production builds, too, by moving the sourcemap generation to later in
the pipeline.

The non-minified builds will still preserve the original symbol names,
and we'll use Prettier to add back whitespace. This is the exact same
approach we've been using for years to generate production builds for
Meta.

The idea is that the only difference between the minified and non-
minified builds is whitespace and symbol mangling. The semantic
structure of the program should be identical.

To implement this, I disabled symbol mangling when running Closure
compiler. Then, in a later step, the symbols are mangled by Terser. This
is when the source maps are generated.

DiffTrain build for [0e0b693](0e0b693)
  • Loading branch information
acdlite committed Apr 19, 2024
1 parent cf94a4a commit 8309f58
Show file tree
Hide file tree
Showing 31 changed files with 269,528 additions and 326,607 deletions.
2,843 changes: 1,333 additions & 1,510 deletions compiled/facebook-www/JSXDEVRuntime-dev.classic.js

Large diffs are not rendered by default.

2,846 changes: 1,335 additions & 1,511 deletions compiled/facebook-www/JSXDEVRuntime-dev.modern.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f5ce642deed7c74c5ae5df54ec4340a8d028eac9
0e0b69321a6fcfe8a3eaae3b1016beb110437b38
Loading

0 comments on commit 8309f58

Please sign in to comment.