Back to Relay

Relay Babel Plugin

website/versioned_docs/version-v20.0.0/getting-started/babel-plugin.md

20.1.1976 B
Original Source

Babel Plugin

Relay requires a Babel plugin to convert GraphQL to compiler-generated runtime artifacts. Depending upon what framework/bundler you are using, there may be a framwork-specific plugin you can use:

If not, you can install the Babel plugin manually:

sh
yarn add --dev babel-plugin-relay graphql

Add "relay" to the list of plugins in your .babelrc file:

javascript
{
  "plugins": ["relay"]
}

Please note that the "relay" plugin should run before other plugins or presets to ensure the graphql template literals are correctly transformed. See Babel's documentation on this topic.