Open willtrking opened 5 years ago
For anyone else running into this, we are working around it with find
and sed
as follows`
Note this only works if your Operations
files are one folder above your generated folder
QUERIES_GENERATED_FOLDER=./graphql/queries/generated
MUTATIONS_GENERATED_FOLDER=./graphql/mutations/generated
find $QUERIES_GENERATED_FOLDER -type f -name "*.generated.tsx" -exec sed -i '' "s|import \* as Operations from './|import * as Operations from \'../|" {} \;
find MUTATIONS_GENERATED_FOLDER -type f -name "*.generated.tsx" -exec sed -i '' "s|import \* as Operations from './|import * as Operations from \'../|" {} \;
this is an old bug, why it is not solved until now?
Hi everyone and thank you for the reports
Sorry but I'm not adding a lot here but just labeling it according to our new Contribution Guide and issue flow.
It seems like we are on stage 0
.
Now in order to advance to stage 1
we need a reproduction in a repo or codesandbox.
Thanks for the great amount of details you provided on the issue, creating the reproduction shouldn't be too hard.
So the biggest benefit would be to advance to stage 2
. In order to get there we'll need a failing test, would be great if someone could help progress the issues through the stages.
Thank you and sorry that this comment is not a complete solution (yet).
Describe the bug When using
importDocumentNodeExternallyFrom: 'near-operation-file'
in combination withdocumentMode: 'external'
import paths are not correctly generated if thenear-operation-file
specifies a custom folderTo Reproduce
Use a config like the following
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