gatsby-plugin-typegen: Generating duplicate types on fragments

Thank you for all the work on the v1 release! I’m experiencing duplicate types being generated when using this along with a plugin that has introspecting GraphQL like Contentful:

ERROR in /Users/fang/app/src/__generated__/gatsby-types.ts(10461,13):
10461:13 Duplicate identifier 'GatsbyContentfulSizes_withWebp_noBase64Fragment'.
    10459 | export type GatsbyContentfulSizes_withWebpFragment = Pick<ContentfulSizes, 'base64' | 'aspectRatio' | 'src' | 'srcSet' | 'srcWebp' | 'srcSetWebp' | 'sizes'>;
    10460 | 
  > 10461 | export type GatsbyContentfulSizes_withWebp_noBase64Fragment = Pick<ContentfulSizes, 'aspectRatio' | 'src' | 'srcSet' | 'srcWebp' | 'srcSetWebp' | 'sizes'>;
          |             ^
    10462 | 
    10463 | export type PagesQueryQueryVariables = {};
    10464 | 

failed Building development bundle - 50.337s

^ This is just one example, it’s happening for all fragments. Is there a current workaround for this or will there need to be a fix? @cometkim

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Peeerfect, 1.1.1 is confirmed to be working. I tested on 1.0.1 which didn’t work before. Thank you for fixing this 🎉

Hey @fandy, can you test it again on v1.1.0? please try and let me know if the problem still happens

Sorry. a few more several tests, even if I created a file outside of src, the same issue occurs when a document changed.

~~Ref https://github.com/apollographql/graphql-tag/pull/278~~

my bad. It does not depend on apollo’s graphql-tag at all