eddeee888 / graphql-code-generator-plugins

List of GraphQL Code Generator plugins that complements the official plugins.
MIT License
46 stars 11 forks source link

contextType path starts with "#" #198

Closed productdevbook closed 4 months ago

productdevbook commented 8 months ago

How can we solve it here? contextType: '#pergel-graphql#PergelGraphQLContext',

import type { CodegenConfig } from '@graphql-codegen/cli'
import { defineConfig } from '@eddeee888/gcg-typescript-resolver-files'

const config: CodegenConfig = {
  schema: 'server/schema/**/schema.graphql',
  documents: ['gql'],
  ignoreNoDocuments: true, // for better experience with the watcher
  emitLegacyCommonJSImports: false,

  generates: {
    'server/schema': defineConfig({
      tsConfigFilePath: 'server/tsconfig.json',
      typesPluginsConfig: {
        contextType: '#pergel-graphql#PergelGraphQLContext',
        useTypeImports: true,
      },
      scalarsOverrides: {
        File: {
          type: 'File',
        },
      },
    }),
  },
  hooks: {
    afterAllFileWrite: ['eslint --fix'],
  },
}
export default config
eddeee888 commented 8 months ago

Hi @productdevbook !

The preset's typesPluginsConfig.contextType just sets the contextType for the underlying typescript-resolvers. If it's fixed in GraphQL Code Generator, it's fixed here too 🙂

I'll take a look at that issue in the next few days. Thanks!

productdevbook commented 4 months ago

fixed: https://github.com/dotansimha/graphql-code-generator/pull/9845