November 20, 2015
What is a transpiler?
The final approval for ES2015 was released back in June 2015. However, not all browser vendors have caught up with the latest specifications. This means that some of the ES2015 code that we write might not be supported out of the box by browsers like Chrome, Firefox and Safari. To get around this we can use these tools called transpilers which convert source code from one language to another language.
Setting up Babel for the command line
- Requires NodeJS >= 0.12
- Install babel-cli globally
- Install babel-preset-es2015 for a project. babel-preset-es2015 is a collection of Babel plugins necessary for transpiling ES2015 code. This module should be installed on a project specific basis.
Here’s the link to GitHub project which contains code of a simple demo script using ES2015 and Babel.