News for hackers. Stuff that matters.
Re:Babili: An ES6+ aware minifier based on Babel by anotherthing on Tuesday August 30, 2016 @05:58PM (#12394288)
Competition is great. The more minifiers the better.

At a usability level, babili has a 33M install footprint and must be installed locally in the directory in which you intend to use it.

uglify-js can be installed globally and has a 1.9M install size.

And I've never understood how to configure babel's preset and plugin files. Why is it necessary for a minifier to do this? Surely this can be greatly simplified.

Re:Babili: An ES6+ aware minifier based on Babel by gavinpc on Tuesday August 30, 2016 @06:38PM (#12394525)
Long live Babel 5.8!

[email protected] is faster than babel 6+, can be installed globally and works out of the box. It just... you know, does what versions 1, 2, 3 & 4 did: compile ES2015 into ES5. So I just use that. Not every project is a "node" project that is already dumping megabytes of dependencies into the project directory. I don't want to have to buy into an entire ecosystem just to use one tool—a shim, at that.

Re:Babili: An ES6+ aware minifier based on Babel by ksherlock on Tuesday August 30, 2016 @08:35PM (#12395072)
I gave up and wrote my own babel cli front end (sudo npm install -g better-babel-cli) for that very reason.

babel --es2015 --babeli infile.js -o outfile.js.

Re:Babili: An ES6+ aware minifier based on Babel by remarkbabel on Tuesday August 30, 2016 @09:48PM (#12395367)
I tried another ES6 to ES5 compiler - buble. But it's too buggy to use right now. I'll revisit it in a year.

https://gitlab.com/Rich-Harris/buble

Re:Babili: An ES6+ aware minifier based on Babel by hzoo on Tuesday August 30, 2016 @06:01PM (#12394306)
The way the minifier is currently implemented is just as a babel preset. We figured users would want to use the tool standalone without babel and the simpliest thing we thought of was to wraps babel-cli and pass in the preset.

https://github.com/babel/babili/blob/master/packages/babili/...

I was thinking about using bundledDependencies or maybe just running webpack/rollup over the whole thing, feel free to make an issue.

Re:Babili: An ES6+ aware minifier based on Babel by BinaryIdiot on Tuesday August 30, 2016 @07:26PM (#12394773)
> We figured users would want to use the tool standalone without babel and the simpliest thing we thought of was to wraps babel-cli and pass in the preset.

With all the other minifiers out there the only real draw here is you're already using babel so toss the minifier at it. If anyone, other than for the novelty of it being new, actually downloads babel ONLY to use the minifier I will eat my hat.

Re:Babili: An ES6+ aware minifier based on Babel by amasad on Tuesday August 30, 2016 @10:38PM (#12395599)
ES6 support is another reason why. And also, once we start doing advanced optimizations you might want to marinate that hat in some nice sauce.
Re:Babili: An ES6+ aware minifier based on Babel by BinaryIdiot on Wednesday August 31, 2016 @01:21AM (#12396189)
> ES6 support is another reason why.

Most will be transpiling that ES6 into ES5 so support isn't that necessary.

> And also, once we start doing advanced optimizations you might want to marinate that hat in some nice sauce.

Better optimizations than Google Closure and / or Uglifier? Color me skeptical and good luck :)

Re:Babili: An ES6+ aware minifier based on Babel by anotherthing on Tuesday August 30, 2016 @06:03PM (#12394327)
`npm install babili` is 33M. Should users know or care what a babel preset is? They just want to minify code.
Re:Babili: An ES6+ aware minifier based on Babel by hzoo on Tuesday August 30, 2016 @06:12PM (#12394374)
Maybe I didn't word that correctly. It was created as a set of babel plugins but because like you said users shouldn't know what a babel preset is we have the cli tool which acts the same as babel-cli so you don't need to do all of that.

Yes, it doesn't need to be 33M that's just a result of the way it was used (babel-cli is that big) and I'm saying that it's something that we can fix

Re:Babili: An ES6+ aware minifier based on Babel by anotherthing on Tuesday August 30, 2016 @06:31PM (#12394494)
Any plans to release minified versions of babili? It would probably shave 90% off the install size.
Re:Babili: An ES6+ aware minifier based on Babel by timdorr on Tuesday August 30, 2016 @06:52PM (#12394606)
Having readable backtraces when something goes wrong is far more valuable to me than saving a couple dozen MB on a 512GB drive.
Re:Babili: An ES6+ aware minifier based on Babel by timdorr on Tuesday August 30, 2016 @09:55PM (#12395392)
Edit: maybe there is some confusion. I'm talking about minifying the tooling, not end user code.
Re:Babili: An ES6+ aware minifier based on Babel by remarkbabel on Tuesday August 30, 2016 @11:38PM (#12395859)
The tools should be minified to reduce their download size and make them run faster (quicker parsing).
Re:Babili: An ES6+ aware minifier based on Babel by BinaryIdiot on Tuesday August 30, 2016 @07:28PM (#12394786)
Then no one would ever minify. Minify makes it faster to download and install (even in some cases it can make the code faster due to some optimizations though I wouldn't bank on it). You minify deployments and, if someone needs to debug, switch to a debug version of the code.
Re:Babili: An ES6+ aware minifier based on Babel by cel1ne on Wednesday August 31, 2016 @08:54AM (#12397912)
I had a lot of gotchas with babel too, until I realized one thing, that should be featured prominently in every bug-tracker having anything to do with babel:

Babel will look for a .babelrc in the current directory of the file being transpiled. If one does not exist, it will travel up the directory tree until it finds either a .babelrc, or a package.json with a "babel": {} hash within.

- https://babeljs.io/docs/usage/babelrc/

So if you have stray files lying around, they might break your build.

Re:Babili: An ES6+ aware minifier based on Babel by timdorr on Tuesday August 30, 2016 @06:57PM (#12394640)
The preset situation has gotten a lot better now.. Most use cases are handled by a small .babelrc file with the latest preset applied (possibly also 'react' if you're doing that sort of thing).

Babili has a single preset too, so it's also really easy to add. And, because it's using the same parse tree from your transpilation step, it doesn't add a ton of overhead to run it.