关于babe-loader^8.0.6的配置问题
1、报错报regeneratorRuntime is not defined 错误
.babelrc配置
{ // https://babeljs.io/docs/en/babel-plugin-transform-runtime#options "plugins": [ "@babel/plugin-transform-runtime" ], // https://babeljs.io/docs/en/babel-plugin-transform-runtime#options "presets": [ [ "@babel/preset-env" ] ] }
npm安装
npm i @babel/plugin-transform-runtime @babel/preset-env @babel/runtime --save-dev
版本
"devDependencies": { "@babel/plugin-transform-runtime": "^7.7.6", "@babel/preset-env": "^7.7.7", "@babel/runtime": "^7.7.7",
"babel-loader": "^8.0.6",
"@babel/core": "^7.8.3",
},
webpack配置
module: { rules: [{ test: /\.js$/, exclude: /(node_modules|bower_components)/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env'],//"plugins"
: [
//
"@babel/plugin-transform-runtime",{
// corejs:3
//}
],
} } } ] }
你要觉得这篇文章比较好,记得点推荐!