GraphQL Codegen issue: Unable to load template plugin matching 'typescript-common'

228 views Asked by At

I am trying to setup GraphQL Code Generator. But I get this error:

gql-gen --config codegen.ts

✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to src/graphql/generated/schema.ts
    ✔ Load GraphQL schemas
    ✔ Load GraphQL documents
    ✖
      Unable to load template plugin matching 'typescript-common'.
      Reason:
      Body must be a string. Received: undefined.
 ELIFECYCLE  Command failed with exit code 1.

My codegen config file:

// codegen.ts
import type { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
  schema: [
    {
      'https://my-endpoint.com': {
        headers: {
          'Introspection-Key': '8787667676867686678432',
        },
      },
    },
  ],
  documents: ['src/components/**/*.gql'],
  generates: {
    'src/graphql/generated/schema.ts': {
      plugins: [
        'typescript-common',
        'typescript-client',
        'typescript-react-apollo',
      ],
    },
  },
};
export default config;

What could be the issue?

0

There are 0 answers