I have setup Graphql codegen with next.js/react and ran the codegen file which generated code for typescript types however when I treed running my next.js application it gave
name `MySomeDocument` is defined multiple times
error.
this is my codegen cofig file
import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
schema: [
"http://1/api/graphql",
"https://2/graphql",
],
documents: ["./utils/graphql/*.ts"],
generates: {
"./utils/generated/": {
preset: "client",
plugins: [
"typescript",
"typescript-operations",
"typescript-react-apollo",
],
},
"./graphql.schema.json": {
plugins: ["introspection"],
},
},
};
export default config.
I have 3 files separate. I tried to remove preset file but then I started getting this when I ran codegen
✖ Plugin "typescript-react-apollo" validation failed:
Plugin "typescript-react-apollo" requires extension to be ".ts" or ".tsx"!
with preset is generating code perfectly but I am getting error in Next.js
how can I fix this issue.