A lightweight utility (v1.2.4, last updated in 2019, no active release cadence) that compresses GraphQL query strings by removing unnecessary whitespace and comments. Key differentiator: minimal dependency, focuses solely on string compression without parsing the GraphQL AST, making it fast and suitable for reducing payload size over network. Ships built-in TypeScript declarations. Not to be confused with graphql-compress or graphql-query-complexity.
npm install graphql-query-compressNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Compresses a multiline GraphQL query string by removing whitespace and comments using the default export.
Test with your query format; if it fails, consider using graphql-query-rewriter or a full parser like graphql-js's stripIgnoredCharacters.
Use only for production network requests; keep original query for development.
Pre-parse or post-process if special handling is needed.
Migrate to `import { stripIgnoredCharacters } from 'graphql'` if using graphql-js.Use `const compress = require('graphql-query-compress').default` or enable esModuleInterop and use import.Use `import compress from 'graphql-query-compress'` in ESM or TypeScript with esModuleInterop.
No dependency data recorded yet.