I am trying to use expo in a project with relay. I can generate files (eg. generated/SomeMutation.graphql.js) with “yarn relay”.
Are those files supposed to be committed? Since they are generated, probably not. How do I auto-generate these?
The FAQ in https://docs.expo.io/versions/latest/introduction/faq#can-i-use-expo-with-relay seems to imply that I could get that automatically without having to run “yarn relay” every time. It says to put “pathToYourBabelRelayPlugin”, but what would that be? I tried “./node_modules/babel-plugin-relay”, but that did nothing.
Am I misunderstanding how to use it or what it’s supposed to do?
That answer in our FAQ is a bit outdated now, since it only applies to Relay Classic. Relay Modern docs have these instructions for setting up Relay Modern that should also work with Expo: https://facebook.github.io/relay/docs/en/installation-and-setup.html
It also mentions you can run the Relay compiler with the
--watch flag (requires installing watchman), and have it generate the files everytime you make changes to your source files.
Also note that in your
.babelrc file the Relay plugin should go in the top level
plugins array since it should be enabled for both development and production builds:
So do I understand this correctly - there’s no way to automatically generate/watch files without running relay with watchman externally?
@dblock you might try using npmjs.org/concurrently – it makes it very easy to run multiple tools in parallel with npm or yarn.
If you open a PR against the docs, please target the
unversioned directory so that the changes will be available in future releases of the SDK as well.
Is there a mechanism to do something like this in Expo? I’m curious whether it’s otherwise implementable.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.