手动es6编译es5(命令行)

时间:2022-02-25 17:44:09
package.json:
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-plugin-transform-es2015-arrow-functions": "^6.8.0",
"babel-preset-es2015": "^6.18.0"
}

需要依赖以上包文件


编写script.js:
'use strict';

let breakfast = (dessert, drink) => dessert + drink;

执行命令 babel script.js -o script-compiled.js
即可