Babel Transpiling - Tuong-Nguyen/JavaScript-Structure GitHub Wiki
Babel coverts javascript file with new features to ES5 for running on browser.
We can use new features:
- import
- string template
- spread and rest operator
- arrow function
- ...
1- Configure Babel in .babelrc 2- Use Babel command: babel-node
- Install:
npm install --save-dev babel-cli babel-preset-env
- Add .babelrc file for defining configuration:
{
"presets": ["env"]
}
Webstorm
- File watcher: File > Settings > Tools > File Watchers: Add Babel
Others
- Install gulp-babel:
npm install --save-dev gulp-babel babel-preset-es2015