Quick babel setup explained and ready for use
npm init
to createpackage.json
npm install --save-dev babel-cli babel-preset-env
to install CLI interface for Babel and Babel preset package which contains configuration for most recent ECMAScript features supported by Babelsrc
folder created withindex.js
filebuild
command added in fieldscripts
topackage.json
for running Babel locally in project and outputindex.js
fromsrc
tolib
Babel is now configured but it isn't doing anything
- create
.babelrc
file in the root directory - add this lines in
.babelrc
file:
{
"presets": ["env"]
}
- clone this repo
- run
npm install
command - write yours ES2015+ code in
src/index.js
- run command
npm run build
๐บ and your ES2015+ code will be transpiled in filelib/index.js