Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: top level ts-node registration bug #8590

Merged
merged 3 commits into from Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silent-singers-cover.md
@@ -0,0 +1,5 @@
---
'@graphql-codegen/cli': major
charlypoly marked this conversation as resolved.
Show resolved Hide resolved
---

register TypeScriptLoader when needed
5 changes: 2 additions & 3 deletions packages/graphql-codegen-cli/src/config.ts
Expand Up @@ -21,9 +21,6 @@ import { createHash } from 'crypto';

const { lstat } = promises;

// #8437: conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register.
const tsLoader = TypeScriptLoader({ transpileOnly: true });

export type CodegenConfig = Types.Config;

export type YamlCliFlags = {
Expand Down Expand Up @@ -77,6 +74,8 @@ function customLoader(ext: 'json' | 'yaml' | 'js' | 'ts') {
}

if (ext === 'ts') {
// #8437: conflict with `graphql-config` also using TypeScriptLoader(), causing a double `ts-node` register.
charlypoly marked this conversation as resolved.
Show resolved Hide resolved
const tsLoader = TypeScriptLoader({ transpileOnly: true });
return tsLoader(filepath, content);
}
}
Expand Down