React Native v0.56:无法在PluginPass.JSXOpeningElement读取未定义的属性“文件名" [英] React Native v0.56: Cannot read property 'filename' of undefined at PluginPass.JSXOpeningElement

查看:144
本文介绍了React Native v0.56:无法在PluginPass.JSXOpeningElement读取未定义的属性“文件名"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将React Native从0.55更新为0.56.

I just updated the React Native from 0.55 to 0.56.

但是,当我尝试运行代码(react-native run-android或run-ios)时,绑定停止到这一点:

However, when I tried to run the code (react-native run-android OR run-ios), bundling stops to this point:

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:

This is my .babelrc:

{
  "presets": [
    "react-native"
  ],
  "env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source"
      ]
    }
  }
}

和package.json

and 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文件夹并再次安装了软件包,但是在那里没有运气.

I have deleted node_modules folder and installed packages again, but no luck there.

任何建议怎么办?任何帮助,将不胜感激!

Any suggestions what to do? Any help would be appreciated!

推荐答案

我删除了

"env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source"
      ]
    }
 }

来自.babelrc,并且有效.

from .babelrc and it worked.

这样我的.babelrc最终看起来像

So that my .babelrc at the end looked like

{ 预设":[本机"] }

{ "presets": ["react-native"] }

这篇关于React Native v0.56:无法在PluginPass.JSXOpeningElement读取未定义的属性“文件名"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆