Closed tlehwalder closed 1 year ago
It looks like the **
at the beginning of documents was the issue
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
schema: "https://beta.pokeapi.co/graphql/v1beta",
documents: "./src/**/*.ts",
generates: {
"src/gql/": {
preset: "client",
plugins: ["@graphql-codegen/typescript-react-apollo"]
}
},
};
export default config;
I am using this config to geenrate the types and it is generating duplicate types
I am using this plugins with next js
Which packages are impacted by your issue?
@graphql-codegen/cli, @graphql-codegen/typescript-operations
Describe the bug
When running graphql-codegen with the provided configuration, the generated output file contains duplicate type definitions for every type.
I run
graphql-codegen --config codegen.ts
the config-file (
codegen.ts
):I found similar issues, where the
preset
was named as the root cause, but i tried different presets and either I get an error or face the same issue.Your Example Website or App
none
Steps to Reproduce the Bug or Issue
graphql-codegen --config codegen.ts
with the given config./generated-graphl-types/graphql.ts
Expected behavior
Types shouldn't be duplicated in the output file
Screenshots or Videos
No response
Platform
Codegen Config File
import type { CodegenConfig } from '@graphql-codegen/cli'
const config: CodegenConfig = { overwrite: true, schema: 'http://localhost:4000', documents: ['/src//.tsx'], // '/src//.ts' generates: { './generated-graphl-types/': { preset: "client-preset", plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'], }, }, }
export default config
Additional context
No response