React Native(Expo)错误消息:require未定义

时间:2019-11-15 02:46:04

标签: react-native expo

我的代码突然出现此错误。我无法查明是什么原因造成的,因为当我上床睡觉时它正在工作。当我早晨再次开始时,突然收到以下错误消息:

abi35_0_0.com.facebook.react.common.javascriptexception: require is not defined

我的项目是一个相当新的项目,而且我大部分时间只是在搭棚。没有太多要显示的内容,但是我已注释掉任何可能引起问题的代码。当应用程序100%正常运行时,我什至退回了3次左右的提交,但问题仍然存在。

在线浏览表明babel可能包含此问题,所以这是我的.babelrc

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "modules": false,
                "useBuiltIns": "usage",
                "corejs": 3
            }
        ],
        "@babel/preset-react"
    ],
    "plugins": [
        [
            "module-resolver",
            {
                "root": [
                    "./src"
                ],
                "extensions": [
                    ".ios.js",
                    ".android.js",
                    ".js",
                    ".json"
                ]
            }
        ],
        "@babel/plugin-syntax-dynamic-import",
        "@babel/plugin-syntax-import-meta",
        "@babel/plugin-proposal-json-strings",
        "@babel/plugin-proposal-export-default-from"
    ]
}

babel.config.js

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
  };
};

在互联网上寻找解决方案已经花费了几个小时,我感到进步已经停止。在这个问题上的任何帮助将不胜感激。

enter image description here

0 个答案:

没有答案