使用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

 

相关文章:

  • 2022-12-23
  • 2021-05-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-20
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案