webpack4 打包报错 :regeneratorRuntime is not defined

使用async函数,在webpack打包时报错

babel-polyfill is required. You must also install it in order to get async/await working.

需要加入babel-polyfill

npm i -D babel-polyfill

这里有个小插曲,经测试发现yarn 无法安装css-loader 1.0.0,

而且若先用npm安装完css-loader后用yarn安装其他包也会报错,可用npm安装

在webpack.config.js 的entry选项中

1 entry: ['babel-polyfill',join("./src/main.js")],

 

参考链接:https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined

 

posted @ 2018-07-14 00:39  xxdw8  阅读(2907)  评论(0编辑  收藏  举报