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:
@dblock you might try using concurrently - npm – 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.