Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 208
Moyote Avatar asked Aug 09 '18 11:08

Moyote


1 Answers

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

like image 73
Dragan Malinovic Avatar answered Oct 24 '22 07:10

Dragan Malinovic