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

client-preset generates imports incompatible with moduleResolution=node16 #10071

Open
shishkin opened this issue Jul 24, 2024 · 0 comments
Open

Comments

@shishkin
Copy link

Which packages are impacted by your issue?

@graphql-codegen/client-preset

Describe the bug

Preset generates imports like import * as types from './graphql'; which are not compatible with TypeScript in ESM mode with moduleResolution node16.

Your Example Website or App

any schema will do

Steps to Reproduce the Bug or Issue

Simply run codegen build.

Expected behavior

When emitLegacyCommonJSImports is disabled, imports should be ESM-compatible.

Screenshots or Videos

No response

Platform

  • OS: MacOS
  • NodeJS: 20
  • @graphql-codegen/cli: 5.0.2
  • @graphql-codegen/client-preset: 4.3.2

Codegen Config File

export default {
    schema: "./src/schema.json",
    documents: ["./src/queries/*.graphql"],
    generates: {
        "./src/gql/": {
            preset: "client",
            presetConfig: {
                useTypeImports: true,
            },
            config: {
                emitLegacyCommonJSImports: false,
            },
        },
    },
};

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant