Until now, closure compiler (java version) has done a good job of minimising my js files. But recently I've been trying to compile a small service worker js file, and am finding that the size actually increases after compilation.
What I find in the "minimised" code is a lot of statements like:
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol
I'm just using defaults in the compilation:
$ java -jar compiler.jar service-worker.js > minified.js
Trying this on the code from here (in the section "Service Worker's JavaScript"), the file size goes from 2.6 KB to 7.6 KB!!
But when I run the same code through the online closure compiler app, I get a much smaller file, without all of the above types of statement.
How do I produce the same type of output, without all the bloat, from the local java version of the closure compiler?
The code you are seeing is the ES6 runtime polyfills. If you don't need them, you can disable their injection by setting the --rewrite_polyfills=false
flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With