-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
coreRelated to codegen core/cliRelated to codegen core/clikind/bugBug :-(Bug :-(stage/1-reproductionA reproduction existsA reproduction exists
Description
Which packages are impacted by your issue?
@graphql-codegen/cli
Describe the bug
I am following the guide for creating a custom loader using TS.
It appears that the codegen fails to load the .ts
loader file yet works ok with a .js
one.
Your Example Website or App
https://codesandbox.io/p/sandbox/graphql-codegen-custom-schema-loader-issue-hkve7f
Steps to Reproduce the Bug or Issue
-
Run
yarn generate
The command fails with an error -
Change
loader.ts
toloader.js
incodegen.ts
-
Run
yarn generate
This time the command will work
Expected behavior
As a user, I expected that the custom schema loader written in TS will work if I follow the guide
Screenshots or Videos
No response
Platform
- OS: [e.g. macOS, Linux]
- NodeJS: 16.17.0
graphql
version: 16.2.0@graphql-codegen/*
version(s): 2.6.2
Codegen Config File
import { CodegenConfig } from "@graphql-codegen/cli";
const config: CodegenConfig = {
schema: {
"schema.graphql": {
// loader: "./loader.js", // JS - ✅ working
loader: "./loader.ts", // TS - ❌ not working
},
},
documents: "document.graphql",
generates: {
"types.ts": { plugins: ["typescript", "typescript-operations"] },
},
};
export default config;
Additional context
Please, note that I am registering the ts-node
for the codegen command.
graphql-codegen -r ts-node/register --config ./codegen.ts
brandhaug and afeferitishermann and goodok21
Metadata
Metadata
Assignees
Labels
coreRelated to codegen core/cliRelated to codegen core/clikind/bugBug :-(Bug :-(stage/1-reproductionA reproduction existsA reproduction exists