News for hackers. Stuff that matters.
Re:Closure Compiler in JavaScript by SpencerWood on Tuesday December 06, 2016 @01:04PM (#13116780)
Why would I use this over babel?
Re:Closure Compiler in JavaScript by vikeri on Tuesday December 06, 2016 @01:13PM (#13116869)
The advanced compilation mode does some pretty powerful dead code removal and minification [1]. I guess that is available from plugins in Babel as well but Google has been using it for Gmail, Google.com etc, so it's quite battle tested.

[1]: https://developers.google.com/closure/compiler/docs/api-tuto...

Re:Closure Compiler in JavaScript by straws on Tuesday December 06, 2016 @01:28PM (#13117010)
Dead code removal relies heavily on writing JS in a style that allows for static analysis. Dynamic requires, heavy usage of closures, knowledge of external/global variables are all things that prevent a lot of commonjs code from being removed. https://developers.google.com/closure/compiler/docs/limitati... has more information if you're interested in the assumptions that the compiler makes.

Interestingly, we're finally starting to see these ideas get more mainstream as people adopt es6 modules and publish bundled code with explicit externs in tools like Webpack 2 and Rollup.

Re:Closure Compiler in JavaScript by masklinn on Tuesday December 06, 2016 @01:41PM (#13117116)
Works very nicely as an LLVM of sort for alt.js languages though, as they can generate JS in such a way that it matches clojure's constraints and requirements.
Re:Closure Compiler in JavaScript by base698 on Tuesday December 06, 2016 @01:23PM (#13116974)
In my experience Babel minified better than Closure Compiler with less maintenance of the externs on my part.
Re:Closure Compiler in JavaScript by cromwellian on Tuesday December 06, 2016 @01:59PM (#13117264)
Only possible in simplified mode. I highly doubt Babel comes close with full optimizations turned on in a nontrivial codebase.
Re:Closure Compiler in JavaScript by AgentME on Tuesday December 06, 2016 @02:07PM (#13117327)
With what plugins? Babel without any plugins or with the common ES2015 plugins doesn't do any minification.
Re:Closure Compiler in JavaScript by randomguy7788 on Tuesday December 06, 2016 @03:59PM (#13118287)
Re:Closure Compiler in JavaScript by wildpeaks on Tuesday December 06, 2016 @01:14PM (#13116889)
Perhaps you meant UglifyJS or Babili instead?

Babel can be used in the same toolchain as Closure Compiler, they're not mutually exclusive or redundant as they perform different tasks.

Re:Closure Compiler in JavaScript by icholy on Tuesday December 06, 2016 @01:11PM (#13116856)
They do different things.
Re:Closure Compiler in JavaScript by randomguy7788 on Tuesday December 06, 2016 @03:59PM (#13118285)
Re:Closure Compiler in JavaScript by untog on Tuesday December 06, 2016 @05:01PM (#13118712)
It's not the same as Babel. You'd use it instead of Webpack, for example.
Re:Closure Compiler in JavaScript by agumonkey on Tuesday December 06, 2016 @07:16PM (#13119445)
afaik babel isn't about performance, but linguistic traits.
Re:Closure Compiler in JavaScript by aeosynth on Tuesday December 06, 2016 @01:12PM (#13116865)
you like lisp