graphql-code-generator
graphql-code-generator copied to clipboard
Option importDocumentNodeExternallyFrom for near-operation-file only imports JS files, but should support TS
Is your feature request related to a problem? Please describe.
When using importDocumentNodeExternallyFrom: near-operation-file
with documentMode: external
the imported operation is expected to be a *.js
file
See: https://github.com/dotansimha/graphql-code-generator/blob/47d0a57e27dd0d2334670bfc6c81c45e00ff4e74/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts#L487
Describe the solution you'd like
Add another config property to change the import file format or inherit it from the operation.
Describe alternatives you've considered
Not using importDocumentNodeExternallyFrom
Additional context

Actually, it probably makes sense not to have the extension at all for the imports
Hi @bohdanbirdie,
Could you update all your @graphql-codegen/*
packages to the last version?
A path has been released that should fix your issue.
Thanks, @charlypoly I tried to do it quickly, but looks like the config file format has been changed from yaml to json, so I will take me a while to edit that
But I can see that the related PR is merged and it looks right to me, so I'll close this issue, and if that won't work for me later I'll re-open it
Thanks again!