-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Query Deduplication doesn't work with babel-plugin-import-graphql #4930
Comments
In Though I'm not familiar with the details of |
I do have just a single query in a The import looks like I think where things are going wrong is the plugin caches the AST or whatever gql spits out. There is an option to use graphql-tag at runtime which does make deduplication work again, so that's what I've done for now but means more dependencies and more going on at runtime. So some things dedup, some don't, and they all seem to kinda use gql so I'm not sure what's up where:
Somewhere in Apollo docs both of those plugins are recommended. And I assume not parsing queries at runtime is better? (Obviously not if it doesn't dedup though) I did try to repro but CodeSanbox's Babel plugin support appears to be broken. |
Ok, I will look into your reproduction and see what I can figure out. Thanks! |
I tried the official webpack loader instead and that actually seems to work great. Doesn't need gql at runtime, and dedup is working. https://github.com/apollographql/graphql-tag#webpack-preprocessing-with-graphql-tagloader The babel plugin's runtime option doesn't really work now, it intermittently complains https://github.com/apollographql/graphql-tag#react-native-nextjs I'd maybe suggest removing that recommendation. I guess it's useful if not using Webpack but it's a bit broken currently. I think this issue can be closed, perhaps a new issue upstream. |
Intended outcome:
Dedup identical queries.
Actual outcome:
Not deduped with babel-plugin-import-graphql when they were with inline gql.
How to reproduce the issue:
Change a query from using gql to using import-graphql. If it's run from multiple components it won't be deduplicated any more.
https://github.com/detrohutt/babel-plugin-import-graphql
Versions
The text was updated successfully, but these errors were encountered: