Describe the bug
V2 outputs Apollo.gql instead of just gql, which means prettier no longer formats the snippets.
To Reproduce
Steps to reproduce the behavior:
I don't believe a repro is necessary, but I can put one together if you need one
@SimenB can you try to alias it and use gql as is? (const gql = Apollo.gql) I think prettier is hardcoded for qql tag, without namespaces.
I can add the aliasing to the generated output. The reason it's there is because we wanted to unify all imports from @apollo/client to a single one.
Yeah, aliasing should work out 馃憤
@SimenB I gave it a try by doing const gql = Apollo.gql; and use the gql tag as-is. IDE seems to respond good to that change, I guess prettier will be fine as well.
Can you please try the alpha? @graphql-codegen/[email protected]
The alpha generates properly prettified code for me, thanks!
Fixed in @graphql-codegen/[email protected]
Hmm, seems this aliasing breaks babel-plugin-graphql-tag: https://github.com/gajus/babel-plugin-graphql-tag/blob/e76450c2cf667ebdac85dc34a0dc5d3fce64ec8c/README.md#known-issues
I think doing import {gql} from '@apollo/client' would make both prettier and the babel plugin happy, not sure how feasible that is, tho
@SimenB In latest version (2.0.6) I removed aliasing and went back to use the imports we had before (also, it was breaking presets...). So now it's back to import {gql} from '@apollo/client'.