Create-react-app: Relay Modern

Created on 20 Apr 2017  路  13Comments  路  Source: facebook/create-react-app

Any plans to support Relay Modern without ejecting in the future?

proposal

Most helpful comment

@gaearon I've built a react-scripts fork that has babel-relay-plugin and a get-schema script when the user needs to download it's schema from the graphql server. I'm using this for my projects that were created with react-scripts and it works perfectly.

Im working on detecting whenever the user has react-relay in their dependencies to install babel-relay-plugin on demand. Then it could be merged to cra?

All 13 comments

@bogdansoare
https://github.com/Valentin-Seehausen/create-react-app
this fork saved me! worth to try.

Eventually, but not in the nearest future.

@gaearon I've built a react-scripts fork that has babel-relay-plugin and a get-schema script when the user needs to download it's schema from the graphql server. I'm using this for my projects that were created with react-scripts and it works perfectly.

Im working on detecting whenever the user has react-relay in their dependencies to install babel-relay-plugin on demand. Then it could be merged to cra?

I鈥檓 not really opposed to adding babel-relay-plugin by default either: https://github.com/facebookincubator/create-react-app/pull/2343. But I want to better understand if it breaks anyone else.

@lpalmes We're building off of your fork and would like to make some modifications, but it looks like you haven't linked the github repo yet. Would it be possible to do that when you get a chance?

Sure @cbranch101, i was using it only for my projects, but i'm glad it helps others. I will push it to github, sorry about that

Hey @cbranch101, there you go: https://github.com/lpalmes/relay-modern-scripts,
I've added a small script that i use for my projects, react-scripts get-schema http://yourapi.com/graphql that downloads your schema and saves it as schema.graphql, i'm constantly modifying my schema, so it's really handy to have a script in your package with your server url

@lpalmes Thanks a lot! And get-schema works great. It's actually what we want to extend. We need to add one more step to also download the introspection query needed for the GraphQL eslint plugin.

That sounds very handy, if you do so please send a pr so we can all benefit, thanks!

Here is an example, how to use create-react-app with Relay Modern (without ejecting):

https://github.com/kriasoft/react-static-boilerplate

That's incredibly fragile. I think it's irresponsible to advertise this to beginners when it can break in any patch version. 馃槥

Filed as https://github.com/kriasoft/react-firebase-starter/issues/278.

This is going to be supported in the next release of Relay via Babel macros.
https://github.com/facebook/create-react-app/pull/2343#issuecomment-413038420

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alleroux picture alleroux  路  3Comments

dualcnhq picture dualcnhq  路  3Comments

barcher picture barcher  路  3Comments

AlexeyRyashencev picture AlexeyRyashencev  路  3Comments

adrice727 picture adrice727  路  3Comments