[英]Cannot read property 'Reactstrap' of undefined When adding @babel/transform-runtime plugin
I'm working on the frontend website using react js, and the webpack loader.我正在使用 react js 和 webpack 加载程序在前端网站上工作。 while in development mode I did not encounter any problems, but when I built the project and got the static file I got an error: Uncaught Type Error: Cannot read property 'Reactstrap' of undefined.
在开发模式下我没有遇到任何问题,但是当我构建项目并获得 static 文件时,我收到一个错误:未捕获类型错误:无法读取未定义的属性“Reactstrap”。 But the error will disappear during development mode if I delete the plugin:
@babel/transform-runtime
, but in production mode an error will appear Uncaught ReferenceError: regeneratorRuntime is not defined.但是在开发模式下,如果我删除插件:
@babel/transform-runtime
,错误会消失,但在生产模式下会出现错误 Uncaught ReferenceError: regeneratorRuntime is not defined。
module.exports = {
entry: path.join(__dirname, "/src/index.js"),
module:
{
rules:[
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: [ "@babel/react","@babel/env" ],
plugins: [
'@babel/transform-runtime',
]
}
},
Please help, thank you.请帮忙,谢谢。
Error Solved, helper cause conflict in function so I'm added this in.babelrc错误已解决,助手在 function 中导致冲突,所以我在.babelrc 中添加了这个
[
"@babel/plugin-transform-runtime",
{
"absoluteRuntime": false,
"corejs": false,
"helpers": false,
"regenerator": true,
"useESModules": true,
"version": "7.0.0-beta.0"
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.