News for hackers. Stuff that matters.
Re:Overview of JavaScript ES6 features by Tankenstein on Monday October 24, 2016 @09:47AM (#12778703)
For anyone who wants to use ES6 in production, https://babeljs.io/ is amazing.
Re:Overview of JavaScript ES6 features by treve on Monday October 24, 2016 @10:55AM (#12779335)
It'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).
Re:Overview of JavaScript ES6 features by pitaj on Monday October 24, 2016 @01:46PM (#12781037)
600MB worth of development dependencies, which don't effect the code being sent to the client. Just wanted to clarify.
Re:Overview of JavaScript ES6 features by treve on Monday October 24, 2016 @05:14PM (#12782967)
I'm using it server-side, so yea, you're not wrong.
Re:Overview of JavaScript ES6 features by vcarl on Monday October 24, 2016 @02:54PM (#12781694)
Doing

    du -ch ./babel*
from my `node_modules` directory yields

    3.2M	total
so I'm gonna need a citation on that 600MB claim.
Re:Overview of JavaScript ES6 features by acemarke on Monday October 24, 2016 @03:39PM (#12782095)
Admittedly, if you're using a flat structure like NPM3 does, then everything else is at the same level :)
Re:Overview of JavaScript ES6 features by vcarl on Monday October 24, 2016 @04:27PM (#12782562)
It caught those! doing `du -ch ./babel` says it's only 20k, babel-core is 148k, and babel-cli is 104k.
Re:Overview of JavaScript ES6 features by treve on Monday October 24, 2016 @04:23PM (#12782520)
537M 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.

Re:Overview of JavaScript ES6 features by vcarl on Monday October 24, 2016 @04:31PM (#12782590)
I 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.
Re:Overview of JavaScript ES6 features by treve on Monday October 24, 2016 @04:56PM (#12782817)
I 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

Re:Overview of JavaScript ES6 features by tlrobinson on Monday October 24, 2016 @08:46PM (#12784273)

    mkdir babel-size-check
    cd babel-size-check
    babel-size-check yarn init -y
    yarn init v0.16.0
    warning The yes flag has been set. This will automatically answer yes to all questions which may have security implications.
    success Saved package.json
      Done in 0.05s.
    babel-size-check yarn add babel babel-core babel-eslint babel-plugin-array-includes babel-plugin-transform-runtime babel-preset-node5 babel-register babel-runtime
    yarn add v0.16.0
    info No lockfile found.
    [1/4]   Resolving packages...
    warning [email protected]: Babel's CLI commands have been moved from the babel package to the babel-cli package
    [2/4]   Fetching packages...
    [3/4]   Linking dependencies...
    [4/4]   Building fresh packages...
    success Saved lockfile.
    success Saved 80 new dependencies.
    ...
      Done in 1.94s.
    babel-size-check du -ch -d1
    17M	./node_modules
    17M	.
    17M	total
Re:Overview of JavaScript ES6 features by tlrobinson on Monday October 24, 2016 @01:56PM (#12781124)
600MB is a huge exaggeration. Looks like about 34MB for babel-cli, babel-preset-es2015, and babel-preset-stage-0.
Re:Overview of JavaScript ES6 features by shados on Tuesday October 25, 2016 @10:17AM (#12788168)
even 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.

Re:Overview of JavaScript ES6 features by fryan on Monday October 24, 2016 @12:03PM (#12780009)
buble 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/

Re:Overview of JavaScript ES6 features by baristaGeek on Monday October 24, 2016 @12:38PM (#12780402)
Have used it in production and it's amazing.

Have you tried Minify(Babili) by the way?