-
-
Notifications
You must be signed in to change notification settings - Fork 88
Description
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!