A drop-in replacement for graphql-tag that automatically deduplicates fragments when composing GraphQL queries. Version 1.0.3 is current and stable, with no significant release cadence. Unlike graphql-tag, which throws duplicate fragment errors, gql-dedup safely includes each fragment only once, enabling reusable fragment composition across deeply nested dependencies. Ships TypeScript types and requires graphql-tag ^2.0.0 and graphql ^14.0.0 as peer dependencies. Ideal for Apollo Client projects that share fragments across multiple queries.
npm install gql-dedupNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates deduplication: both fragments are included, none duplicated.
Replace import from 'graphql-tag' with 'gql-dedup'.
Use resetCaches() to clear cache if needed.
Always use ${fragmentVar} after the GraphQL string.Pin graphql to ^14.0.0 if using this library.
Change to 'import gql from "gql-dedup"' and ensure ESM module resolution.
Ensure fragments are defined on correct types and used on compatible parent types.
Replace import from 'graphql-tag' with 'gql-dedup'.