第一种
1,npm init -y (初始化)
2,npm install -g babel-cli (全局安装babel-cli)
3,npm install --save-dev babel-preset-es2015 babel-cli (本地安装babel-preset-es2015 和 babel-cli)
4,新建.babelrc (并且写入代码)
{ "presets":[ "es2015" ], "plugins":[] }
5,修改package.json (改变scripts里边的内容)
"scripts": { "build": "babel src/index.js -o dist/index.js" },
6,运行npm run build
第二种
1,npm init -y (初始化)
2,cnpm install -g live-server
3,live-server