✖ [client-preset] target output should be a directory, ex: "src/gql/" #8684
-
Here's my codegen.ts file generated via import type {CodegenConfig} from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
// schema: "http://graphql.test/wp-central/public/lighthouse-schema.graphql",
// schema: "http://graphql.test/wp-json/central/api/graphql",
schema: "./lighthouse-schema.graphql",
documents: "src/**/*.{tsx,ts}",
// documents: "src/**/*.graphql",
generates: {
"src/gql": {
// preset: "client",
plugins: ["typescript"],
preset: "client",
},
},
};
export default config; When I run graphql-codegen --config codegen.ts it gives me :
But why, src/gql is there proof:
Doesn't tell me |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
did you try making it |
Beta Was this translation helpful? Give feedback.
-
I think you need to add Full code: import type { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
overwrite: true,
// schema: "http://graphql.test/wp-central/public/lighthouse-schema.graphql",
// schema: "http://graphql.test/wp-json/central/api/graphql",
schema: "./lighthouse-schema.graphql",
documents: "src/**/*.{tsx,ts}",
// documents: "src/**/*.graphql",
generates: {
"src/gql/": {
// preset: "client",
plugins: ["typescript"],
preset: "client",
},
},
};
export default config; |
Beta Was this translation helpful? Give feedback.
-
Thank you! Just ran into this too. I do think the docs could use a little more detail in terms of a step-by-step process, with a couple of notes about potential gotchas. |
Beta Was this translation helpful? Give feedback.
@Stevemoretz
I think you need to add
/
after the directory key, should besrc/gql/
instead ofsrc/gql
.Full code: