dotansimha / dotansimha/graphql-code-generator
importDocumentNodeExternallyFrom generates incorrect import path
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
When using `importDocumentNodeExternallyFrom: 'near-operation-file'` in combination with `documentMode: 'external'` import paths are not correctly generated if the `near-operation-file` specifies a custom folder
**To Reproduce**
Use a config like the following
```
overwrite: true
schema: 'schema.graphql'
documents: './graphql/**/*.gql.ts'
generates:
/:
preset: near-operation-file
presetConfig:
extension: .generated.tsx
baseTypesPath: types.ts
folder: generated
cwd: '/'
plugins:
- 'typescript-operations'
- 'typescript-react-apollo'
config:
documentMode: 'external'
importDocumentNodeExternallyFrom: 'near-operation-file'
withHooks: true
withHOC: false
reactApolloVersion: 3
```
It looks like it is hard-coded to import from the same folder here:
https://github.com/dotansimha/graphql-code-generator/blob/cc8ca46b120bd30620cee9d2897c93fa4db51c1a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts#L306
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.