babel
Transcoder es6->es5
first step
Install the babel tool, use the command, view the version number
npm install --global babel-cli
babel --version
Second step
Configuration file
.babelrc (fixed suffix)
{
"presets": ["es2015"],
"plugins": []
}
third step
Install transcoder
npm install --save-dev babel-preset-es2015
the fourth step
转码结果写入一个文件
mkdir dist1
#--out-file 或 -o 参数指定输出文件
babel src/example.js --out-file dist1/compiled.js
或者 babel src/example.js -o dist1/compiled.js
整个目录转码
mkdir dist2
--out-dir 或 -d 参数指定输出目录
babel src --out-dir dist2
或者
babel src -d dist2