Graphql-code-generator: Frontend plugins should support `apolloClientVersion: 3` flag to change the imports

Created on 15 Jul 2020  路  3Comments  路  Source: dotansimha/graphql-code-generator

typescript-react-apollo already supports reactApolloVersion: 3 to modify the imports of Apollo client and React-Apollo.
We need to make sure to support apolloClientVersion: 3 as well in those plugins, in order to modify the import of gql tag.

This is relevant to all plugins that are related to Apollo.

Previously it was imported from graphql-tag library, but now it could be imported from: @apollo/client now.

A workaround for that is to do:

gqlImport: "@apollo/client#gql"

If someone want to do that- feel free, PRs are welcome ;)

enhancement plugins waiting-for-release

Most helpful comment

Available in @graphql-codegen/[email protected] 馃帀

All 3 comments

Also note that there will be React Apollo 4.0 soon which will be the final version, because all React functionality is now available directly from the @apollo/client package. See: https://github.com/apollographql/react-apollo

I fixed it in https://github.com/dotansimha/graphql-code-generator/pull/4487 , also v3 of Apollo-Client and Hooks should be generated by default now. alpha version available if someone want to try it 1.17.8-alpha-f79b3113.0

Available in @graphql-codegen/[email protected] 馃帀

Was this page helpful?
0 / 5 - 0 ratings