• Robert Knight's avatar
    Improve compression of JavaScript bundles · 1b975962
    Robert Knight authored
    Previously only the _contents_ of modules were minified, but not the
    module infrastructure that Browserify adds around it. Given lots of modules,
    this adds up.
    
    Replace `uglifify` with a small wrapper around terser, the package that
    actually compresses the code, and use it to minify both the contents of
    modules and the generated wrapper code. Calling terser directly allows
    us to a) use the current version of it (uglifyify was stuck on Terser
    3.x) and b) upgrade/configure/replace it more directly in future.
    
    One other change here is that minifying modules is now done _after_ the
    transform that replaces `if (process.env.NODE_ENV == ...)` checks with
    `if (true)` or `if (false)`. This enables dead-code removal to remove
    the logic entirely.
    
    This reduces the minified size of `sidebar.bundle.js` from 368 KB to 311
    KB (-15%) and `annotator.bundle.js` from 170 KB to 152 KB (-12.7%).
    Some vendor bundles are smaller, others are unaffected because they were
    already fully minified. The total minified size of all bundles is reduced by ~7%.
    1b975962
Name
Last commit
Last update
.github Loading commit data...
bin Loading commit data...
docs Loading commit data...
embedding-examples Loading commit data...
images Loading commit data...
scripts Loading commit data...
src Loading commit data...
.babelrc Loading commit data...
.dockerignore Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.prettierignore Loading commit data...
.prettierrc Loading commit data...
.python-version Loading commit data...
.travis.yml Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Dockerfile Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
gulpfile.js Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...
tox.ini Loading commit data...
yarn.lock Loading commit data...