-
-
Notifications
You must be signed in to change notification settings - Fork 27
Description
The readme doesn't make it clear if this Babel plugin is able to replace gql when it is imported from places other than graphql-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:
The
@apollo/clientpackage includesgraphql-tagas a dependency and re-exportsgql. To simplify your dependencies, we recommend importinggqlfrom@apollo/clientand removing allgraphql-tagdependencies.
— https://www.apollographql.com/docs/react/migrating/apollo-client-3-migration/#graphql-tag
This seems like bad advice. They don't even follow their own advice in their "Compiling queries with Babel" docs:
This approach will allow you to use the
graphql-taglibrary as usual
— https://www.apollographql.com/docs/react/performance/babel/#using-babel-plugin-graphql-tag
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.