Skip to content

Commit

Permalink
improve: Optimised imports from graphql to decrease bundle size (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
VrajKD authored Jun 15, 2023
1 parent 6d2569a commit e5c8e7f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/resolveRequestDocument.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import type { RequestDocument } from './types.js'
import type { DocumentNode, OperationDefinitionNode } from 'graphql'
import { parse, print } from 'graphql'
/**
* Refactored imports from `graphql` to be more specific, this helps import only the required files (100KiB)
* instead of the entire package (>500KiB) where tree-shaking is not supported.
* @see https://github.com/jasonkuhrt/graphql-request/pull/543
*/
import type { DocumentNode, OperationDefinitionNode } from 'graphql/language/ast.js'
import { parse } from 'graphql/language/parser.js'
import { print } from 'graphql/language/printer.js'

/**
* helpers
Expand Down

0 comments on commit e5c8e7f

Please sign in to comment.