cometkim / gatsby-plugin-typegen

Let's give developers using GatsbyJS better DX with extreme type-safety
https://www.gatsbyjs.org/packages/gatsby-plugin-typegen/
MIT License
204 stars 23 forks source link

tagName option seems to be ignored #139

Closed marconucara closed 2 years ago

marconucara commented 3 years ago

I've both gql and graphql tag in my project and I want to generate only graphql because are the ones used by gatsby.

Still I got some error relative to gql queries.

Moreover, looking at the source of this plugin it seems to me that this option is never managed, am I wrong?

Thanks

EDIT: I just noticed that you actually use the GRAPHQL_TAG_PLUCK_OPTIONS that include the correct identifier graphql (not taken from tagName option but whatever) and still I see that both gql and graphql are extracted, at least in components that use both.

cometkim commented 3 years ago

As I mentioned from README this plugin support only graphql tag from gatsby, so you would need additional codegen config for graphql-tag or something.

and there was an issue from tag pluck

https://github.com/cometkim/gatsby-plugin-typegen/issues/99

I'm not sure this has been resolved from upstream.

marconucara commented 3 years ago

I actually need only graphql tag but other tags are included too if some file use both. I temporary solved removing gql queries from the file that use graphql queries, but it seems a bug to me.

cometkim commented 2 years ago

This is fixed in v3 (current RC) v3 relies on Gatsby's SET_GRAPHQL_DEFINITIONS API instead of graphql-tools. so It would not break again.

If you need a separate gql tag for non-gatsby env, you may still need graphql-tools.