Using codegen plugins

The doc here seems to say that we can overwrite default codegen config. But only the config key. I really like the typescript-react-apollo plugin. And I don’t see a way to add it to the list of plugins for codegen, that list seems to be hard coded in redwood (see here)

Does anyone knows if there’s a way to add a plugin to codegen in redwood?

2 Likes

I jest watched a video on the apollo code generator. Looks cool. Did you figure this out?

I agree with Standup75 that it will be interesting to be able to add other plugin in the codegen config

I like the idea of custom codegen plugins.
But I also think, that the functionality of typescript-react-apollo could be easily implemented with a custom redwood generator. So you keep your QUERY within your cell and add an additional hook to it.

I am doing this manually right now, and add i.e something like this at the end of EditScenarioCell:

export const useUpdateScenario = (options?: GraphQLMutationHookOptions<any, GraphQLOperationVariables>) => {
  const [result, mutation] = useMutation(UPDATE_SCENARIO_MUTATION, options)
  return [result, mutation] as const
}