Closed brandonmp closed 7 years ago
i should add that i also using babel-plugin-react-relay
as a complement to graphql-config
, version 0.9.3-3
The errors pointed me to this repo, though, which is why I posted here
Hi @brandonmp. Since babel-plugin-react-relay
uses graphql-config
and relies on providing a configuration method. Could you describe why you don't want to put in the right data in a .graphqlrc
file or similar?
thanks @schickling - the reason for trying to put fake data in .graphqlrc
is just to prevent the graphql-config
from connecting to my graphql-endpoint in certain situations. there are 2 situations I've found where I've wanted to run an NPM script in my react-relay
project directory, but haven't bene able to stop graphql-config
from initializing and contacting my endpoint:
react-storybook
development. i was traveling somewhere and wanted to work on the plane, but I found that, because graphql-config
was starting even when i ran npm run storybook
instead of starting my normal development server, i was unable to start it w/out removing graphl-config
. it'd be nice to be able to toggle it on/off in those instances
(situation I mention in OP) I have a node microservice I was trying to put in a subrepository in my react-relay
project directory. it had its own package.json
with no graphql-config
, but it seemed that graphql-config
was still starting every time i tried to run the development server.
both of these could be due to my misunderstanding of how babel-plugin-react-relay
hooks into my npm scripts, so maybe there is already a solution i don't know about. is it because my .babelrc
mentions babel-plugin-react-relay
? or because it's in the project root's package.json
?
but if there is no way to gracefully disable it arbitrarily, it would be nice to have the option of running npm scripts
in my project directory without starting babel-plugin-react-relay
/graphql-config
I see. Your use case makes sense. As a fallback for these scenarios a good way would be to download the GraphQL schema as a JSON file and use the JSON configuration option.
I'm not sure if we should add an additional configuration option based on an edge case. Happy to hear other thoughts on this!
slightly embarrassing but i actually hadn't tried the JSON
option :-/
i just configured it but it seems like it's perfect for my use-case. thanks for taking the time to point me to it @schickling
Great to hear @brandonmp. I'll close this issue for now. If someone else experiences a similar situation, feel free to ask for re-open.
I'm trying to configure webpack to build a subrepository I have in my
react/relay
project. the subrepo doesn't require a graphql endpoint, so I'd like to disablegraph-config
when executing the subrepo's webpack configs.however, when calling
webpack
from the project's root (with its ownpackage.json
), I'm still facing build errors:I tried setting an empty object to
.graphqlrc
or throwing in a fakeendpoint
, but no dice.How is
graphql-config
even hooking onto this build command? I'm not using the samewebpack.config.js
orpackage.json
/node_modules
as the parent repo.subrepo's stuff: