简体   繁体   English

添加@babel/transform-runtime 插件时无法读取未定义的属性“Reactstrap”

[英]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.

相关问题 Babel插件“transform-runtime”仅在首次编译后才有效 - Babel plugin “transform-runtime” only works after first compile Babel 6转换运行时:$ export不是函数 - Babel 6 transform-runtime: $export is not a function Webpack 4 + Babel 7转换运行时-无效的配置对象 - Webpack 4 + Babel 7 transform-runtime - Invalid configuration object 模块构建失败:TypeError:插件“transform-runtime”没有导出插件实例 - Module build failed: TypeError: The plugin "transform-runtime" didn't export a Plugin instance 在“ Users \\\\ PhpstormProjects \\\\ easy-essay \\\\。babelrc”中指定的未知插件“ transform-runtime” - Unknown plugin “transform-runtime” specified in "Users\\PhpstormProjects\\easy-essay\\.babelrc Uncaught TypeError:使用babel编译JSX代码时,无法读取未定义的属性'keys' - Uncaught TypeError: Cannot read property 'keys' of undefined when compiling JSX code with babel 无法读取未定义的属性,运行时错误 - Cannot read property of Undefined, Runtime Error Babel + Node.js TypeError:无法读取未定义的属性“默认” - Babel + nodejs TypeError: Cannot read property 'default' of undefined 无法读取未定义的属性'rollupVersion'或如何使用汇总和babel设置gulp - Cannot read property 'rollupVersion' of undefined or how to setup gulp with rollup and babel Babel - 无法读取未定义的属性“TYPED_ARRAY_SUPPORT” - Babel - Cannot read property 'TYPED_ARRAY_SUPPORT' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM