最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React Native v0.56: Cannot read property 'filename' of undefined at PluginPass.JSXOpeningElement -

programmeradmin2浏览0评论

I just updated the React Native from 0.55 to 0.56.

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) 

This is my .babelrc:

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

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",
  }

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

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

I just updated the React Native from 0.55 to 0.56.

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) 

This is my .babelrc:

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

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",
  }

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

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

Share Improve this question asked Aug 9, 2018 at 11:05 MoyoteMoyote 1,21711 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 24

I removed

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

from .babelrc and it worked.

So that my .babelrc at the end looked like

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论