Max RozenMax Rozen

How do you make relay-compiler run automatically?

Max Rozen
@RozenMD

Making relay-compiler run automatically

Relay can be annoying to work with as relay-compiler needs to run every time you change your GraphQL schema, or your resolvers.

With relay-compiler-webpack-plugin that's no longer the case - webpack can run it for you!

Here's how you use it:

const RelayCompilerWebpackPlugin = require('relay-compiler-webpack-plugin');
// rest of your config
new RelayCompilerWebpackPlugin({
schema: 'schema.graphql',
src: 'src/',
extensions: ['js', 'jsx', 'ts', 'tsx'],
artifactDirectory: 'src/__generated__',
}),

Do you struggle to keep up with best practices in React?

I send a single email every two weeks with an article like this one, to help you keep track of what's happening in the React ecosystem.

Lots of developers like them, and I'd love to hear what you think as well. You can always unsubscribe.

    Join 1,508 React developers that have signed up so far!