当我启动我的项目时,我收到一个 ReferenceError: Can't find variable: __DEV__ 错误.我已经注释掉了我几乎所有的代码,现在只有这个
When I launch my project I am getting a ReferenceError: Can't find variable: __DEV__ error. I have commented out almost all of my code and now only have this
import React, { Component, Text } from "react-native"; var { AppRegistry } = React; class Root extends Component { render() { return ( <Text>App</Text> ); } } AppRegistry.registerComponent("App", () => Root);我尝试清除我的 node_modules 文件夹并从 Xcode 进行干净的构建.打包程序控制台输出没有显示任何问题,Xcode 控制台为空白.在这一点上,我不知道还能尝试什么.
I have tried wiping out my node_modules folder and doing a clean build from Xcode. The packager console output doesn't show any problems and the Xcode Console is blank. At this point I don't know what else to try.
推荐答案问题出在我的 .babelrc 文件中有 "strict".看起来 react-native 正在分配 __DEV__ 而不声明它.
The problem was having "strict" in my .babelrc file. It appears that react-native is assigning __DEV__ without declaring it.
github/facebook/react-native/issues/3605
更多推荐
参考错误:找不到变量:
发布评论