Skip to content
Discussion options

You must be logged in to vote

Good thing you reached out, and thanks for the repo! Let's fix it.

The first thing to mention here is that documents field is missing from codegen's config:

const config: CodegenConfig = {
  schema: printSchema(schema),
+ documents: ['app/**/*.tsx'],
  generates: {
    './gql/': {
      preset: 'client',
      plugins: []
    }
  }
}

Then, GraphQL documents should be defined within backticks:

const query = graphql(/* GraphQL */ `
  query {
    greetings
  }
`);

Finally, anonymous queries and mutations are ignored, we need to provide a name for that query:

const query = graphql(/* GraphQL */ `
+ query Greetings {
    greetings
  }
`);

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@viveleroi
Comment options

@charpeni
Comment options

@viveleroi
Comment options

@charpeni
Comment options

Answer selected by viveleroi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants