r/javascript • • Dec 05 '16

Dear JavaScript

https://medium.com/@thejameskyle/dear-javascript-7e14ffcae36c
807 Upvotes

271 comments sorted by

View all comments

0

u/fooey Dec 05 '16

I'm still amazed at what happened with Babel. It swung from being the most amazing thing to come out of the JS community, to symbolizing what people hate about JS, practically overnight.

Babel is a great example of why people need to think long and hard about the default settings they ship with.

I understand why the change was made, but it still annoys me every single time I have to setup a new project.

6

u/trakam Dec 05 '16

As someone relatively new to js and the community can you give me brief account of what babel was and what happened to it so that I can understand OPs article better?

21

u/Geldan Dec 05 '16 edited Dec 05 '16

Babel started as 6to5, which converted modern javascript to stuff that old browsers could understand.

It changed to Babel when the maintainers realized they were providing a great piece of software that would be useful long after browsers support es6.

Before version 6 Babel pretty much automatically just transpiled es6 to es5. After version 6, you have to specify what you want to transpiled. This often means just adding a reference to a preset in one of a number of ways: https://babeljs.io/docs/plugins/preset-latest/

It's still extremely useful, and the changes were necessary to keep the project ahead of the curve where it naturally lives due to its nature. For some reason, however, a large number of people got salty about having to add a line of configuration even though it is a useful and necessary feature.

Edit: the name of 6to5

→ More replies (1)

7

u/fooey Dec 05 '16 edited Dec 05 '16

Like the article says, they changed it from being a drop in, that worked for most people without having to configure anything, to an approach where it does nothing by default.

Babel is still a foundational piece of modern WebDev, but the Babel 6 release changed its public image from being an amazing tool, to being just another thing in a stack of things you have to learn and configure before you can even start writing JS.

Babel 5 was npm install babel

Babel 6 needed a guide and documentation:
https://babeljs.io/blog/2015/10/31/setting-up-babel-6
https://babeljs.io/blog/2015/10/29/6.0.0

4

u/acemarke Dec 05 '16

Babel is primarily a Javascript-to-Javascript compiler. It was originally known as "6to5", and is mostly used for compiling newer ES6 syntax to older ES5 syntax for compatibility with browsers that don't yet support all of ES6.

Originally, Babel implemented all the syntax parsing and transformation logic internally, so there was a single "babel" package that gave you all the capabilities built-in. That also included support for some not-yet-final pieces of syntax, like decorators. However, the Babel authors decided to switch to a plugin-based architecture, with each individual bit of syntax as a separate plugin. That was good for modularity, but many people were upset that they now had to install and manage lots of different plugins to get the same capabilities they used to get "out of the box". Also, since Babel is usually used with a bundling tool like Webpack, there's frustration at the overall amount of configuration that's often needed to get a brand new project set up.

Babel is a fantastic and vital tool, and ultimately the switch to a plugin architecture is a good thing, but it did cause a lot of churn and frustration for people. Tools like Create-React-App have helped simplify the setup process, and I think the upcoming babel-preset-env plugin will also help a lot of people.

→ More replies (4)