1.打包時出錯且不壓縮代碼是由於沒有正確的轉換語法node
npm install babel-core babel-preset-env babel-loader --save-devwebpack
2.若是使用了async await等es7新語法還要安裝web
npm install babel-plugin-transform-runtime --save-devnpm
3.webpack.config.js中配置babel
module:{ rules:[ { test:/(\.jsx|.js)$/, use:{ loader:"babel-loader", options:{ presets:["env"] } }, exclude:/node_modules/ } ] }
4. .babelrc文件中配置async
"plugins":[ [ "transform-runtime", { "helpers": false, "polyfill": false, "regenerator": true, "moduleName": "babel-runtime" } ] ]