graphql-code-generator: TypeError: camelCase.camelCase is not a function
Describe the bug type error
To Reproduce Steps to reproduce the behavior:
gql-gen --config codegen.yml
then this:
TypeError: camelCase.camelCase
is not a function
at ReactApolloVisitor._buil
dHooksJSDoc (/home/capaj/work-repos
/looop/project-alpha3/node_modules/
@graphql-codegen/typescript-react-a
pollo/index.cjs.js:148:23)
at ReactApolloVisitor._buil
dHooks (/home/capaj/work-repos/looo
p/project-alpha3/node_modules/@grap
hql-codegen/typescript-react-apollo
/index.cjs.js:176:34)
at ReactApolloVisitor.build
Operation (/home/capaj/work-repos/l
ooop/project-alpha3/node_modules/@g
raphql-codegen/typescript-react-apo
llo/index.cjs.js:233:52)
at ReactApolloVisitor.Opera
tionDefinition (/home/capaj/work-re
pos/looop/project-alpha3/node_modul
es/@graphql-codegen/visitor-plugin-
common/index.cjs.js:1768:33)
at Object.visit
(/home/capaj/work-repos/looop/proje
ct-alpha3/node_modules/graphql/lang
uage/visitor.js:242:26)
at Object.plugin
(/home/capaj/work-repos/looop/proje
ct-alpha3/node_modules/@graphql-cod
egen/typescript-react-apollo/index.
cjs.js:249:35)
at executePlugin
(/home/capaj/work-repos/looop/proje
ct-alpha3/node_modules/@graphql-cod
egen/core/index.cjs.js:60:41)
at process._tickCallback (i
nternal/process/next_tick.js:68:7)
TypeError: camelCase.camelCase
is not a function
at ReactApolloVisitor._buil
dHooksJSDoc (/home/capaj/work-repos
/looop/project-alpha3/node_modules/
@graphql-codegen/typescript-react-a
pollo/index.cjs.js:148:23)
at ReactApolloVisitor._buil
dHooks (/home/capaj/work-repos/looo
p/project-alpha3/node_modules/@grap
hql-codegen/typescript-react-apollo
/index.cjs.js:176:34)
at ReactApolloVisitor.build
Operation (/home/capaj/work-repos/l
ooop/project-alpha3/node_modules/@g
raphql-codegen/typescript-react-apo
llo/index.cjs.js:233:52)
at ReactApolloVisitor.Opera
tionDefinition (/home/capaj/work-re
pos/looop/project-alpha3/node_modul
es/@graphql-codegen/visitor-plugin-
common/index.cjs.js:1768:33)
at Object.visit
(/home/capaj/work-repos/looop/proje
ct-alpha3/node_modules/graphql/lang
uage/visitor.js:242:26)
at Object.plugin
(/home/capaj/work-repos/looop/proje
ct-alpha3/node_modules/@graphql-cod
egen/typescript-react-apollo/index.
cjs.js:249:35)
at executePlugin
(/home/capaj/work-repos/looop/proje
ct-alpha3/node_modules/@graphql-cod
egen/core/index.cjs.js:60:41)
at process._tickCallback (i
nternal/process/next_tick.js:68:7)
- My GraphQL schema:
I don't think it's needed, I can amend this if it is
- My GraphQL operations:
I don't think it's needed, I can amend this if it is
- My
codegen.ymlconfig file:
overwrite: true
generates:
front-end/src/graphql/gqlPrivateSchema.tsx:
schema: 'gqlSchemas/private.graphql'
documents:
- 'front-end/**/*.gql'
- '!front-end/src/app-admin/**'
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
- add: '/* THIS IS A GENERATED FILE, DO NOT EDIT */'
front-end/src/app-admin/graphql/gqlSuperuserSchema.tsx:
schema: 'gqlSchemas/superuser.graphql'
documents:
- 'front-end/src/app-admin/**'
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
- add: '/* THIS IS A GENERATED FILE, DO NOT EDIT */'
front-end/src/graphql/gqlPrivateSchemaFragments.tsx:
schema: 'gqlSchemas/private.graphql'
plugins:
- fragment-matcher
- add: '/* THIS IS A GENERATED FILE, DO NOT EDIT */'
config:
withHooks: true
withHOC: false
withComponent: false
apolloReactHooksImportFrom: '@apollo/react-hooks'
reactApolloVersion: 3
scalars:
EmailAddressWithTLD: string
NonNegativeFloat: number
NonNegativeInt: number
PositiveInt: number
DateTime: string
namingConvention:
enumValues: keep
hooks:
afterOneFileWrite:
- prettier --write
Expected behavior no type error
Environment:
- OS:
@graphql-codegen/...: 1.10.1- NodeJS: 10.17.0
Additional context
On 1.9.1 it compiles without any issue
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 15 (1 by maintainers)
Also experiencing this after the latest version update
@kolengri Your case is a little bit different 😃
change-casehas introduced some breaking changes recently. That package is independent from codegen. But we decided to add some workaround code while loading the function by usingnamingConventionoption.1.10.1-alpha-3fc7bb8a.6should work for all of you 😃I’ve tried reproduce it here. https://codesandbox.io/s/gifted-golick-xjg0h?fontsize=14&hidenavigation=1&theme=dark
In sandbox I have
→ Cannot find module 'change-case': ) Hope it will help youFixed in 1.11.0
I installed
1.10.1-alpha-d8c376b0.18and it fixed the problem. @ardatan Thanks.Same problem.
1.10.1-alpha-c25db63c.4does not solve it for me@coreylight Could you try
1.10.1-alpha-c25db63c.4canary version for all packages (both ts-react-apollo and cli)?