我刚刚将React Native从0.55更新为0.56。
但是,当我尝试运行代码(react-native run-android或run-ios)时,绑定停止到这一点:
Loading dependency graph, done.
error: bundling failed: TypeError: Cannot read property 'filename' of undefined
at PluginPass.JSXOpeningElement ({path_to_my_project}/react-native/node_modules/babel-plugin-transform-react-jsx-source/lib/index.js:32:39)
这是我的.babelrc:
{
"presets": [
"react-native"
],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
]
}
}
}
和package.json
"dependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5.0.2",
"react": "16.4.1",
"react-native": "0.56.0",
}
我已经删除了node_modules文件夹并再次安装了软件包,但是没有运气。
任何建议怎么办?任何帮助,将不胜感激!
答案 0 :(得分:20)
我删除了
"env": {
"development": {
"plugins": [
"transform-react-jsx-source"
]
}
}
来自.babelrc,并且有效。
这样我的.babelrc最终看起来像
{ “预设”:[“本机”] }