mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-24 04:53:04 +00:00
7ef925fb97
It is probably not that critical to understand if "09/11/2016" refers to September 11th or November 9th. I still think it's worth looking for a documentation format that is easy to understand by an international developers community. My personal best practice is to use the ISO format. Change-Id: Ib209a8a1651970d74f82c188ae4b84d1a4eb534e
44 lines
1.4 KiB
Markdown
44 lines
1.4 KiB
Markdown
# 8. Enable minification of bundle with UglifyJS
|
|
|
|
Date: 2017-05-12
|
|
|
|
## Status
|
|
|
|
Accepted
|
|
|
|
## Context
|
|
|
|
Sources are currently minified by JSMin producing a bundle bigger than
|
|
necessary. We want to produce a JS bundle as small as possible to ship less
|
|
code to clients.
|
|
|
|
Given we have a pre-compilation step in Popups, we can leverage node based
|
|
tooling without penalty, so using UglifyJS to minify the code is an option.
|
|
|
|
We performed some analysis to see the differences in asset size between the two
|
|
tools. See:
|
|
|
|
* [Minifying assets with uglifyjs][1]
|
|
|
|
Results with the current codebase as of today 12th of May 2017 are that uglify
|
|
produces a 40% smaller bundle, and a 25% smaller bundle when using gzip.
|
|
|
|
This results are stable through the last 3 months, the same test has been
|
|
performed multiple times. See [Compressed JS comparison][2]
|
|
|
|
## Decision
|
|
|
|
Webpack's production mode has been enabled for `npm run build`, and thus the
|
|
compiled bundle will be minified in production with UglifyJS.
|
|
|
|
See [Enable production settings for the production bundle][3]
|
|
|
|
## Consequences
|
|
|
|
The Popups bundle served in production is 40% smaller, 25% when using GZIP.
|
|
|
|
|
|
[1]: https://www.mediawiki.org/wiki/Extension:Popups/Minifying_assets_with_uglifyjs
|
|
[2]: https://www.mediawiki.org/wiki/User:JHernandez_(WMF)/Compressed_JS_comparison
|
|
[3]: https://github.com/wikimedia/mediawiki-extensions-Popups/commit/7bd29bb0582fc3d592ce2c242ac12df205d3a537
|