5 ms·
Why would I use this over babel?
by SpencerWood 10y ago
Why would I use this over babel?
- icholy 10y agoThey do different things.
- aeosynth 10y agoyou like lisp
- vikeri 10y agoThe 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-tutorial3 https://developers.google.com/closure/compiler/docs/api-tuto...
- base698 10y agoIn my experience Babel minified better than Closure Compiler with less maintenance of the externs on my part.
- cromwellian 10y agoOnly possible in simplified mode. I highly doubt Babel comes close with full optimizations turned on in a nontrivial codebase.
- AgentME 10y agoWith what plugins? Babel without any plugins or with the common ES2015 plugins doesn't do any minification.
- randomguy7788 10y agosee http://www.syntaxsuccess.com/viewarticle/tree-shaking-in-javascript http://www.syntaxsuccess.com/viewarticle/tree-shaking-in-jav...
- straws 10y agoDead 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/limitations 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.
- masklinn 10y agoWorks 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.
- wildpeaks 10y agoPerhaps 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.
- randomguy7788 10y agohttp://www.syntaxsuccess.com/viewarticle/tree-shaking-in-javascript http://www.syntaxsuccess.com/viewarticle/tree-shaking-in-jav... use it with babel by using splittable.js
- agumonkey 10y agoafaik babel isn't about performance, but linguistic traits.
- untog 10y agoIt's not the same as Babel. You'd use it instead of Webpack, for example.