3 ms·
I've long felt that the front end community could benefit from making heavier use of the Closure Compiler. It has been very good for a very long time now. The
by rpeden 10y ago
I've long felt that the front end community could benefit from making heavier use of the Closure Compiler. It has been very good for a very long time now.
The downside to its age is that it likes to do things its own way; it's had a static module system since long before ES2015 modules or even CommonJS modules existed. It does have support for other module systems now, though. And as the article mentions, it performs optimizations far beyond what other JS tools do.
One of the big things people disliked about the compiler is that to get maximum optimizations out of it, you had to write your JS in a relatively static way, preferably with JSDoc type annotations.
This is less of a barrier now, I think; TypeScript has become quite popular in the front end community, and the Angular team has created TSickle[1], which allows the TypeScript compiler to output Closure annotated JS.
Webpack is a lot more capable, but also results in shipping a much larger code bundle to your users. This might not matter so much for desktop clients, but in many parts of the world, mobile users still have pretty restrictive data caps, and overages are very expensive.
[1]https://github.com/angular/tsickle https://github.com/angular/tsickle