Open Daavidaviid opened 5 years ago
Thanks for reporting this, and for the easy repro instructions. I'll try my best to check this out over the weekend!
Hi,
I have the same error since I changed my react-native version from 0.55.4 to 0.57.5 (but seems to happen too on 0.56.x). I tried on IOS and android.
However my situation is a bit different.
./react-native-app/
./src/
./components
./compA
./query.js (including my gql file)
./myQuery.gql
I tried to move query.js from directories but it still does not work.
I don't manage to run my project anymore, so even a work around would be great :-)
Ok for my part was because I had something wrong with my package and versions and in my .babelrc RN 57 requires to update few things like the preset "metro-react-native-babel-preset" instead of the deprecated one and it requires to change the .baberc like following :
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": ["import-graphql"]
}
@detrohutt It works on windows but the same code on IOS give the same error message :-(
Did someone already tried on IOS ?
This issue may be a path problem too https://github.com/detrohutt/babel-plugin-import-graphql/issues/50
Hi, Thanks for your work.
I don't know if you're aware of it, but I lost a lot of time because of a very specific issue today. When the structure of your react-native project is the following :
It resulted every time in an error like :
build failed: couldn't find module "./graphql/queries/query.graphql"
But if I nest .js files in a
/src/
directory, and the structure is like this :Only then it works. And I'm aware that I have to remove the babel cache everytime I update something
.graphql
related. You can reproduce this bug by simply creating a new project with :1/
react-native init project
2/ Follow the instruction to install this library 3/ Create a dumb./graphql/queries/query.graphql
4/ Try to import it from./App.js
Regards.