dotansimha / dotansimha/graphql-code-generator
Plugin typescript does not export a valid JS object with "plugin" function.
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
Keep getting the following issue
```
Plugin typescript does not export a valid JS object with "plugin" function.
Make sure your custom plugin is written in the following form:
module.exports = {
plugin: (schema, documents, config) => {
return 'my-custom-plugin-content';
},
};
```
my dependencies are as follows
```
"@graphql-codegen/cli": "^2.4.8",
"@graphql-codegen/near-operation-file-preset": "^2.2.9",
"@graphql-codegen/typescript": "^2.4.8",
"@graphql-codegen/typescript-apollo-client-helpers": "^2.1.15",
"@graphql-codegen/typescript-operations": "^2.3.5",
"@graphql-codegen/typescript-react-apollo": "^3.2.11",
```
and my codegen.yml is
```
overwrite: true
schema: "./schema.gql"
generates:
schema.ts:
plugins:
- "typescript"
./:
preset: near-operation-file
presetConfig:
extension: .generated.ts
baseTypesPath: "./schema.ts"
documents: '../**/src/**/*.gql'
plugins:
- add:
content: '/* eslint-disable */'
- "typescript-operations"
- "typescript-react-apollo"
- "typescript-apollo-client-helpers"
config:
exportFragmentSpreadSubTypes: true
hooks:
afterAllFileWrite:
- eslint --fix
- prettier --write
```
Following instructions found here https://github.com/dotansimha/graphql-code-generator/pull/6716 I can resolve the issue by installing `@babel/runtime` however this is not a could option as installing `@babel/runtime` causes other things in my code base to fail
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.