GraphQL codegen is not generating the type from a query inside a .astro file

80 views Asked by At

In my GraphQL Codegen config file:

// codegen.ts
const config: CodegenConfig = {
  overwrite: true,
  schema: [
    {
      'http:endpoint' {
        headers: {
          'Introspection-Key': 'my-key',
        },
      },
    },
  ],
  documents: ['./src/**/*.astro', 'src/components/**/*.ts'],
  generates: {
    'src/graphql/schema.ts': {
      plugins: [
        'typescript',
        'typescript-operations',
        'typescript-react-apollo',
      ],
    },
  },
};

export default config;

I have the following query inside [slug].astro:

const GET_PAGE = gql`
  query GetPage($url: String!) {
    page(url: $url) {
      id
      my-field
    }
  }
`;

When I run pnpm run generate it doesn't generate the type from my .astro file?

0

There are 0 answers