4 ms·
For anyone who wants to use ES6 in production, https://babeljs.io/ https://babeljs.io/ is amazing.
by Tankenstein 10y ago
For anyone who wants to use ES6 in production, https://babeljs.io/ https://babeljs.io/ is amazing.
- treve 10y agoIt's both amazing, and 600MB worth of dependencies. We use it for server-side code. It's high quality, and we only have a few issues with it, but I can't wait to be able to ditch is (pretty much when async/await lands in a stable node).
- fryan 10y agobuble is a good alternative - small and fast. Doesn't support all of ES2015, but it does support the examples in the article. https://buble.surge.sh/guide/ https://buble.surge.sh/guide/
- pitaj 10y ago600MB worth of development dependencies, which don't effect the code being sent to the client. Just wanted to clarify.
- treve 10y agoI'm using it server-side, so yea, you're not wrong.
- tlrobinson 10y ago600MB is a huge exaggeration. Looks like about 34MB for babel-cli, babel-preset-es2015, and babel-preset-stage-0.
- vcarl 10y agoDoing du -ch ./babel* from my `node_modules` directory yields 3.2M total so I'm gonna need a citation on that 600MB claim.
- acemarke 10y agoAdmittedly, if you're using a flat structure like NPM3 does, then everything else is at the same level :)
- vcarl 10y agoIt caught those! doing `du -ch ./babel` says it's only 20k, babel-core is 148k, and babel-cli is 104k.
- treve 10y ago537M here. babel* matches the following packages: node_modules/babel node_modules/babel-core node_modules/babel-eslint node_modules/babel-plugin-array-includes node_modules/babel-plugin-transform-runtime node_modules/babel-preset-node5 node_modules/babel-register node_modules/babel-runtime Of course you can just pretend I'm lying.
- vcarl 10y agoI believe that you're getting that number, but there might be something wrong with your install. I just installed all of those packages and ended up at 6MB.
- treve 10y agoI don't think it's such a stretch. From facebook's yarn announcement[1]: > or example, updating a minor version of babel generated an 800,000-line commit that was difficult to land and triggered lint rules for invalid utf8 byte sequences, windows line endings, non png-crushed images, and more. Merging changes to node_modules would often take engineers an entire day. I just did a fresh install in a new directory and ended up with 114M worth of dependencies, so I'm not entirely sure what the difference is. My point is. 50MB, 114MB, or 500MB worth of javascript dependencies is a massive footprint. It works and I'm relatively happy with what it does, but I don't see this as a stable, long term thing. [1]: https://code.facebook.com/posts/1840075619545360 https://code.facebook.com/posts/1840075619545360
- shados 10y agoeven once all the language features you want are in, Babel is amazing for other things such as optimizations, transforms, injecting assertions depending on environment, inlining stuff, static analysis, etc. If you use Flow its used to strip out annotations, and if you use JSX (not just in React) its great there too. We get a lot of millage out of it even when our target platforms support all the language features we need. Your millage may vary.
- deleted 10y ago[deleted]
- baristaGeek 10y agoHave used it in production and it's amazing. Have you tried Minify(Babili) by the way?