cnpm install -g babel-cli
npm init
cnpm install babel-preset-es2015 --save
{
"name": "es6",
"version": "1.0.0",
"description": "",
"main": "index.js",
"babel": {
"presets": ["es2015"]
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-preset-es2015": "^6.24.1"
}
}
问题:1.配置cnpm install babel-preset-es2015 --save 时提示deprecate. 2.在package.json中添加了"babel": {
"presets": ["es2015"]
},但是在命令行中babel index.js还是报错,这样加参数就行babel index.js --presets es2015
慕森王
相关分类