-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does this work for gql imported from @apollo/client? #41
Comments
https://github.com/StefanYohansson/babel-plugin-graphql-tag/tree/feat/add-apollo-v3-support I made a branch for this and I have a big project to test it. I am including this branch there and changing imports from graphql-tag to @apollo/client in order to test. Get back here when things works (or crashes lol) EDIT: it works for me :) |
Moving the discussion regarding based on @jaydenseric last comment on my PR
I have some problems making "all the known ways" because it is pretty much open for interpretations based on developer imagination:
So I changed from It is really hard to cover all the bases when it is broadly open to interpretation. Another problem that I found is regarding destructing after import in the case of new '@apollo/client'
I hope someone doesn't use things like that :/ Btw, require is working alongside this importSources modification on this PR: #45 |
Should we ignore the |
|
Nevermind, thanks! It looks like the case is officially supported. I thought it was still problematic because this issue remained open. |
The readme doesn't make it clear if this Babel plugin is able to replace
gql
when it is imported from places other thangraphql-tag
; namely@apollo/client
.I tried to load this plugin in the Babel REPL to find out, but it never loads successfully. In a Next.js repo, looking at the resulting bundle, it seems to not work?
No one could answer the question here. I'm surprised the community hasn't smoothed this over yet, since Apollo is advising everyone to import
gql
from@apollo/client
for Apollo Client v3 which had a very long beta period:This seems like bad advice. They don't even follow their own advice in their "Compiling queries with Babel" docs:
Maybe Apollo didn't give much thought to performance when designing and documenting their new API?
Either way, if this plugin doesn't handle
gql
imported from@apollo/client
it probably needs to moving forward.The text was updated successfully, but these errors were encountered: