Skip to content

Commit e5c8e7f

Browse files
authored
improve: Optimised imports from graphql to decrease bundle size (#543)
1 parent 6d2569a commit e5c8e7f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/resolveRequestDocument.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import type { RequestDocument } from './types.js'
2-
import type { DocumentNode, OperationDefinitionNode } from 'graphql'
3-
import { parse, print } from 'graphql'
2+
/**
3+
* Refactored imports from `graphql` to be more specific, this helps import only the required files (100KiB)
4+
* instead of the entire package (>500KiB) where tree-shaking is not supported.
5+
* @see https://github.com/jasonkuhrt/graphql-request/pull/543
6+
*/
7+
import type { DocumentNode, OperationDefinitionNode } from 'graphql/language/ast.js'
8+
import { parse } from 'graphql/language/parser.js'
9+
import { print } from 'graphql/language/printer.js'
410

511
/**
612
* helpers

0 commit comments

Comments
 (0)