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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM