Skip to content

Commit 67e7556

Browse files
authored
fix: link for bundle size reduction docs (#10075)
1 parent 942c25d commit 67e7556

File tree

25 files changed

+41
-1
lines changed

25 files changed

+41
-1
lines changed

.changeset/pretty-berries-matter.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@graphql-codegen/gql-tag-operations': patch
3+
'@graphql-codegen/client-preset': patch
4+
---
5+
6+
Add note about enabling bundle size reduction for the generated `graphql` tag file.

dev-test/gql-tag-operations-masking/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n fragment TweetFragment on Tweet {\n id\n body\n ...TweetAuthorFragment\n }\n':

dev-test/gql-tag-operations-urql/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument,

dev-test/gql-tag-operations/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument,

dev-test/gql-tag-operations/graphql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument,

examples/persisted-documents-string-mode/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as types from './graphql';
1010
* 3. It does not support dead code elimination, so it will add unused operations.
1111
*
1212
* Therefore it is highly recommended to use the babel or swc plugin for production.
13+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1314
*/
1415
const documents = {
1516
'\n query HelloQuery {\n hello\n }\n': types.HelloQueryDocument,

examples/persisted-documents/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query HelloQuery {\n hello\n }\n': types.HelloQueryDocument,

examples/react/apollo-client-defer/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n fragment SlowFieldFragment on Query {\n slowField(waitFor: 5000)\n }\n': types.SlowFieldFragmentFragmentDoc,

examples/react/apollo-client-swc-plugin/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':

examples/react/apollo-client/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':

examples/react/http-executor/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':

examples/react/nextjs-swr/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':

examples/react/tanstack-react-query/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as types from './graphql';
1010
* 3. It does not support dead code elimination, so it will add unused operations.
1111
*
1212
* Therefore it is highly recommended to use the babel or swc plugin for production.
13+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1314
*/
1415
const documents = {
1516
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':

examples/react/urql/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as types from './graphql';
1010
* 3. It does not support dead code elimination, so it will add unused operations.
1111
*
1212
* Therefore it is highly recommended to use the babel or swc plugin for production.
13+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1314
*/
1415
const documents = {
1516
'\n query allFilmsWithVariablesQuery199($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':

examples/typescript-esm/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query AllPeopleQuery {\n allPeople(first: 5) {\n edges {\n node {\n name\n homeworld {\n name\n }\n }\n }\n }\n }\n':

examples/typescript-graphql-request/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as types from './graphql';
1010
* 3. It does not support dead code elimination, so it will add unused operations.
1111
*
1212
* Therefore it is highly recommended to use the babel or swc plugin for production.
13+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1314
*/
1415
const documents = {
1516
'\n query AllPeopleQuery {\n allPeople(first: 5) {\n edges {\n node {\n name\n homeworld {\n name\n }\n }\n }\n }\n }\n':

examples/vite/vite-react-cts/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':

examples/vite/vite-react-mts/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':

examples/vite/vite-react-ts/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':

examples/vue/apollo-composable/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n ':

examples/vue/urql/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n ':

examples/vue/villus/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n ':

examples/yoga-tests/src/gql/gql.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1111
* 3. It does not support dead code elimination, so it will add unused operations.
1212
*
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
14+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
1415
*/
1516
const documents = {
1617
'\n query HelloQuery {\n hello\n }\n ': types.HelloQueryDocument,

packages/plugins/typescript/gql-tag-operations/src/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ function getDocumentRegistryChunk(sourcesWithOperations: Array<SourceWithOperati
146146
lines.add(` * 1. It is not tree-shakeable, so it will include all operations in the project.\n`);
147147
lines.add(` * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n`);
148148
lines.add(` * 3. It does not support dead code elimination, so it will add unused operations.\n *\n`);
149-
lines.add(` * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\n`);
149+
lines.add(` * Therefore it is highly recommended to use the babel or swc plugin for production.\n`);
150+
lines.add(
151+
` * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size\n */\n`
152+
);
150153
lines.add(`const documents = {\n`);
151154

152155
for (const { operations, ...rest } of sourcesWithOperations) {

packages/presets/client/tests/client-preset.spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export * from "./gql";`);
4949
* 3. It does not support dead code elimination, so it will add unused operations.
5050
*
5151
* Therefore it is highly recommended to use the babel or swc plugin for production.
52+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
5253
*/
5354
const documents = {
5455
"\\n query A {\\n a\\n }\\n": types.ADocument,
@@ -136,6 +137,7 @@ export * from "./gql";`);
136137
* 3. It does not support dead code elimination, so it will add unused operations.
137138
*
138139
* Therefore it is highly recommended to use the babel or swc plugin for production.
140+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
139141
*/
140142
const documents = {
141143
"\\n query a {\\n a\\n }\\n": types.ADocument,
@@ -215,6 +217,7 @@ export * from "./gql";`);
215217
* 3. It does not support dead code elimination, so it will add unused operations.
216218
*
217219
* Therefore it is highly recommended to use the babel or swc plugin for production.
220+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
218221
*/
219222
const documents = {
220223
"\\n query a {\\n a\\n }\\n": types.ADocument,
@@ -295,6 +298,7 @@ export * from "./gql";`);
295298
* 3. It does not support dead code elimination, so it will add unused operations.
296299
*
297300
* Therefore it is highly recommended to use the babel or swc plugin for production.
301+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
298302
*/
299303
const documents = {
300304
"\\n query A {\\n a\\n }\\n": types.ADocument,
@@ -425,6 +429,7 @@ export * from "./gql";`);
425429
* 3. It does not support dead code elimination, so it will add unused operations.
426430
*
427431
* Therefore it is highly recommended to use the babel or swc plugin for production.
432+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
428433
*/
429434
const documents = {
430435
"\\n query A {\\n a\\n }\\n": types.ADocument,
@@ -548,6 +553,7 @@ export * from "./gql";`);
548553
* 3. It does not support dead code elimination, so it will add unused operations.
549554
*
550555
* Therefore it is highly recommended to use the babel or swc plugin for production.
556+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
551557
*/
552558
const documents = {
553559
"\\n query a {\\n a\\n }\\n": types.ADocument,
@@ -661,6 +667,7 @@ export * from "./gql";`);
661667
* 3. It does not support dead code elimination, so it will add unused operations.
662668
*
663669
* Therefore it is highly recommended to use the babel or swc plugin for production.
670+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
664671
*/
665672
const documents = {
666673
"\\n query A {\\n a\\n }\\n": types.ADocument,
@@ -1008,6 +1015,7 @@ export * from "./gql.js";`);
10081015
* 3. It does not support dead code elimination, so it will add unused operations.
10091016
*
10101017
* Therefore it is highly recommended to use the babel or swc plugin for production.
1018+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
10111019
*/
10121020
const documents = {
10131021
"\\n query A {\\n a\\n }\\n": types.ADocument,
@@ -2682,6 +2690,7 @@ export * from "./gql.js";`);
26822690
* 3. It does not support dead code elimination, so it will add unused operations.
26832691
*
26842692
* Therefore it is highly recommended to use the babel or swc plugin for production.
2693+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
26852694
*/
26862695
const documents = {
26872696
"\\n query Foo {\\n foo {\\n ...Foo\\n }\\n }\\n": types.FooDocument,

0 commit comments

Comments
 (0)