webpack4 打包報錯 :regeneratorRuntime is not defined

使用async函數,在webpack打包時報錯css

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

須要加入babel-polyfillweb

npm i -D babel-polyfill

這裏有個小插曲,經測試發現yarn 沒法安裝css-loader 1.0.0,npm

並且若先用npm安裝完css-loader後用yarn安裝其餘包也會報錯,可用npm安裝babel

在webpack.config.js 的entry選項中async

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

 

參考連接:https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined函數

相關文章
相關標籤/搜索