Use Google Closure Compiler instead of UglifyJS2 #4
Conversation
Comparison with be66655Bundle size: 290K / 78K gzipped |
This changeset consists of several parts. First, in order to get the most out of GCC's advanced optimisations, I need to make use of its ability to parse ES6 (`language_in=ECMASCRIPT6`). This means that the es2015 Babel transformations are not only superfluous, but are detrimental to GCC's optimiser. After trying Rollup and the `transform-es2015-modules-commonjs` Babel transformer, I decided that was using CommonJS was the path of least resistance. Next, GCC's advanced optimisations rename object properties. This is especially for this codebase not only because of the interoperation with other libraries, but also because of the consumption of remote JSON files. To work around this, much of the object property notation has been converted to use `obj['prop']` rather than `obj.prop` notation. Finally, Webpack's default minimize optimisation is disabled. Since `-p` implies `--optimize-minimize --optimize-occurence-order`, I now run `webpack --optimize-occurence-order` and allow the GCC Webpack plugin to perform its own minimize optimisations.
wildlyinaccurate
added a commit
that referenced
this pull request
Oct 19, 2016
Use Google Closure Compiler instead of UglifyJS2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
With
webpack -p
Bundle size: 59K / 15K gzipped
With
webpack --optimize-occurence-order
and GCCBundle size: 41K / 13K gzipped 30% / 13% smaller