dotansimha / dotansimha/graphql-code-generator-community
[typescript-react-query] custom fetcher path incorrect when using near-operation-file
- Dominant language
- TypeScript
- Stars
- 137
- Forks
- 195
- Avg merge
- 6h 20m
- Merged PRs (30d)
- 16
Description
**Describe the bug**
I'm trying to set up typescript-react-query to work together with the near-operation-file preset, and having a difficulty with a custom `fetcher` config option. The path that I provide seems to be used as-written in each generated file, rather than being adjusted based on the location of the file.
**To Reproduce**
Steps to reproduce the behavior:
https://codesandbox.io/s/graphql-code-generator-6904-40u7s?file=/src/getUser.generated.ts
Note the path to the custom fetcher is incorrect, it is not relative to the file, but uses the string from the config exactly.
3. My `codegen.yml` config file:
```yml
generates:
./src/types.ts:
plugins:
- typescript
./src:
preset: near-operation-file
presetConfig:
baseTypesPath: ./types.ts
plugins:
- typescript-operations
- typescript-react-query
config:
useTypeImports: true
fetcher:
func: './src/api/fetch#customFetcher'
```
**Expected behavior**
I expect that the `fetcher` would attempt to resolve to my file, and then each time it's referenced, the relative path from the generated file to the custom fetcher file would be used.
**Environment:**
- OS: mac
- `@graphql-codegen/...`: See reproduction
- NodeJS: 16
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.