-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Document the use of babel-relay-plugin with React Native #935
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Further reading: #714. |
I can read over #714 and add a paragraph that explains why we need to configure the babel-relay-plugin to run before the react-native. Modifications should be made here correct: https://facebook.github.io/relay/docs/guides-babel-plugin.html#content? Thanks again. |
That sounds like a good place. Thanks!
|
Summary:This adds a paragraph here, https://facebook.github.io/relay/docs/guides-babel-plugin.html#content, under Usage describing how to configure the babel-relay-plugin with React Native. Fixes issue #935. Closes #941 Differential Revision: D3179444 Pulled By: josephsavona fb-gh-sync-id: 22bb274b1618d437d476c9d5217c8695c902c13c fbshipit-source-id: 22bb274b1618d437d476c9d5217c8695c902c13c
Hey guys, is this broken for anyone else on 0.9? I'm getting |
Hey @abhishiv! Post a question on Stack Overflow with the tag #relayjs with as much detail as you possibly can about your setup. Be sure to post a link back here so we can follow up. |
Thanks Steve, I was finally able to track it down. It seems to be a very strange issue. I'll just leave the resolution in this thread in case someone else gets stuck like me. @BerndWessels/babel-relay-plugin-loader |
This configuration does not seem to work as soon as your code or one of your lib use the class property method of ES2015. I mean this: class A {
bar () { return "it works!"; }
foo = () => this.bar();
}
new A().foo(); it breaks with the config mentioned above. Why not just: {
"presets": ["react-native"],
"plugins": [
"./plugins/babelRelayPlugin"
]
} ^^^ This seems to work and don't have the issue i'm mentionning. ( context gre/gl-react-native-v2#90 (comment) ) |
@gre class properties after babel-core 6.5 does not work with passPerPreset.(https://phabricator.babeljs.io/T7274) @steveluscher wondering if |
@chirag04 been using this solution for quite a while, and it works fine for me |
My working setup is the same as @gre’s. |
BTW, digging into this a bit – The order in which plugins run is actually:
This means that if you apply the template literal transform in a preset, then as long as you specify the Relay transform in |
BTW, I would suggest recommending against the use of |
(Spring cleaning.) This issue was created nearly a year ago and is now quite stale. Going to close it out, but please feel free to submit any improvements to the documentation as PRs; we're always happy to see the documentation get better. |
Can someone add a little note to the docs that explains how and why to configure the babel-relay-plugin to run before the
react-native
Babel preset?The text was updated successfully, but these errors were encountered: