Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Closure on non-minified prod builds, too #28827

Merged
merged 1 commit into from
Apr 19, 2024

Commits on Apr 19, 2024

  1. Run Closure on non-minified prod builds, too

    In facebook#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.
    acdlite committed Apr 19, 2024
    Configuration menu
    Copy the full SHA
    44ca36d View commit details
    Browse the repository at this point in the history