Relay: [modern] 1.3 Doesn't compile in React Native

Created on 30 Aug 2017  路  17Comments  路  Source: facebook/relay

After upgrading from 1.2 to 1.3 i've got this error when building the project:

error: 
bundling failed: "TransformError: /Users/vladslavshabanov/projects/project/node_modules/relay-debugger-react-native-runtime/lib/index.js: 
[BABEL] /Users/vladslavshabanov/projects/project/node_modules/relay-debugger-react-native-runtime/lib/index.js: 
Unknown option: /Users/vladslavshabanov/projects/project/node_modules/react/index.js.Children. 
Check out http://babeljs.io/docs/usage/options/ for more information about options.\n\nA common cause of this error is the presence of a configuration options object without the corresponding preset name. 
Example:\n\nInvalid:\n  `{ presets: [{option: value}] }`\nValid:\n  `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. 
(While processing preset: \"/Users/vladslavshabanov/projects/project/node_modules/react/index.js\")"

I suspect that issues is introduced by 87b5a9a

bug

Most helpful comment

I'll work on fixing this soon for the next Relay release

All 17 comments

me too 馃挰

Getting the same error now

Having the same problem, looks like babel presets, specified in
node_modules/relay-debugger-react-native-runtime/.babelrc are not installed,
after adding them manually
yarn add -D babel-preset-react babel-preset-stage-0 babel-preset-es2015
and restarting packager compiles fine, my .babelrc:

{
  "plugins": [
    "relay"
  ],
  "presets": [
    "react-native"
  ]
}

babel-plugin-relay 1.3.0
react-relay 1.3.0
relay-compiler 1.3.0

Doesn't work for me

+1 me too

Well it works now. Did the following

yarn add -D babel-preset-react babel-preset-stage-0 babel-preset-es2015

then restart your packager

馃憤 edited my comment

@Oxyaction that worked! 馃憤

I don't think relay-debugger-react-native-runtime is open source yet, but it seems like the issue is that these packages:

  • babel-preset-react
  • babel-preset-stage-0
  • babel-preset-es2015

Need to be listed as dependencies and not devDependencies in the relay-debugger-react-native-runtime.

@Slava I believe you are/have worked on relay-debugger-react-native-runtime. Does this fix make sense to you?

We should figure out why those babel presets are required and fix that instead of adding them as dependencies.

@kassens I no longer have access to the source. I remember moving .babelrc into src folder for the relay-debugger-react-native-runtime so it doesn't get picked up by babel when the lib folder is imported. I thought that would help but either I didn't publish that version to npm or it didn't do the trick.

I'll work on fixing this soon for the next Relay release

+1

Seems to be fixed in 1.4.
Thanks!

@vshab can we close this?

@sibelius i think yes. Can't reproduce in 1.4

close then

Was this page helpful?
0 / 5 - 0 ratings