-
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%.
db5d11b8
Analyzing file…