Open hichriHoussem opened 6 years ago
My #import
implementation doesn't currently respect the NODE_PATH
setting, so the path you used above would be relative to the .gql
file.
My personal solution would be to use a "Find and replace in project" (I use Atom editor) with a regex pattern to correct the imports by prepending ../
or whatever depending on what level your .gql
files are relative to the src
folder. Hopefully most of them are At the same depth and you can fix the remaining ones manually. Depending on your folder structure this may not be helpful, but that's the only idea I have. 🙁
I have a similar issue, but I think this is also an issue with fragments coming from a node_module
. Unfortunately, the workaround with manually prepending ../
doesn't always work.
Consider the following scenario:
A imports B
A imports C
C imports B
where B is the GQL fragment
Since npm install
may dedupe the installation, then B would only exist in the node_module
of A
, and C
should technically resolve B
from A
's node_modules
, but because it's resolved as a relative, it'll be trying to reference a non-existing dependency of C
.
So running a chai test on a react component that require a gql file (graphQL query)
the npm script:
as you can see the gql document importing a fragment for the schema the problem is that when i run the test the gql file is trying to take the fragment path as a relative so it look for the file in the wrong location path= 'path_to_gql_schema/path_to_gql_fragment' So I got a no such file or directory error, which can be solved with changing the fragment path to relative.
how can we fix that without changing all gql files fragments path to relative (about a handred) ?