Skip to content

graphql-codegen-client-preset doesn't respect codegen.ts namingConvention #521

@tombryden

Description

@tombryden

Describe the bug
The graphql-codegen-client-preset plugin doesn't respect codegen.ts namingConvention field. It always capitalizes the first character.

The default for client-preset is PascalCase which was causing some of the imports post-swc to not match.

To workaround this you can set the codegen.ts namingConvention to: config: { namingConvention: "change-case-all#upperCaseFirst" }

URL to minimal reproduction
https://github.com/tombryden/swc-codegen-plugin-bug

Expected behavior
Running pnpm build should succeed in the reproduction repo, but it fails with error:

Export SomeEGRocketsDocument doesn't exist in target module
The export SomeEGRocketsDocument was not found in module [project]/src/gql/graphql.ts [app-client] (ecmascript).
Did you mean to import SomeEgRocketsDocument?

This is because the default for client preset in codegen.ts is PascalCase, causing swc's SomeEGRocketsDocument import not to match the codegen SomeEgRocketsDocument.

You can uncomment the line in codegen.ts and run pnpm codegen then pnpm build to see it working.

Additional context

fn capetalize(s: &str) -> String {

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions