From af288ed4c5216a77a8fc1d300119d333850bb88e Mon Sep 17 00:00:00 2001 From: ghou9khub Date: Mon, 26 Jan 2026 18:54:05 -0800 Subject: [PATCH 1/2] Added browserCompatible option into docs and cli --- graphql/codegen/README.md | 4 ++++ graphql/codegen/src/cli/index.ts | 5 ++++- graphql/codegen/src/cli/shared.ts | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/graphql/codegen/README.md b/graphql/codegen/README.md index a0bf12ce4..7d00aee78 100644 --- a/graphql/codegen/README.md +++ b/graphql/codegen/README.md @@ -183,6 +183,8 @@ interface GraphQLSDKConfigTarget { // Generator flags reactQuery?: boolean; // Generate React Query hooks (output: {output}/hooks) orm?: boolean; // Generate ORM client (output: {output}/orm) + browserCompatible?: boolean; // Generate browser-compatible code (default: true) + // Set to false for Node.js with localhost DNS fix // Table filtering (for CRUD operations from _meta) tables?: { @@ -683,6 +685,8 @@ Generator Options: -t, --target Target name in config file -o, --output Output directory -a, --authorization Authorization header value + --browser-compatible Generate browser-compatible code (default: true) + Set to false for Node.js with localhost DNS fix --skip-custom-operations Only generate table CRUD operations --dry-run Preview without writing files --keep-db Keep ephemeral database after generation (pgpm modes) diff --git a/graphql/codegen/src/cli/index.ts b/graphql/codegen/src/cli/index.ts index eabcc5e2b..0ff023a5c 100644 --- a/graphql/codegen/src/cli/index.ts +++ b/graphql/codegen/src/cli/index.ts @@ -33,6 +33,8 @@ Generator Options: -o, --output Output directory -t, --target Target name (for multi-target configs) -a, --authorization Authorization header value + --browser-compatible Generate browser-compatible code (default: true) + Set to false for Node.js with localhost DNS fix --dry-run Preview without writing files -v, --verbose Show detailed output @@ -120,6 +122,7 @@ export const commands = async ( authorization: answers.authorization, reactQuery: answers.reactQuery, orm: answers.orm, + browserCompatible: answers.browserCompatible, dryRun: answers.dryRun, verbose: answers.verbose, }); @@ -142,7 +145,7 @@ export const options: Partial = { v: 'verbose', }, boolean: [ - 'help', 'version', 'verbose', 'dry-run', 'react-query', 'orm', 'keep-db', + 'help', 'version', 'verbose', 'dry-run', 'react-query', 'orm', 'keep-db', 'browser-compatible', ], string: [ 'config', 'endpoint', 'schema-file', 'output', 'target', 'authorization', diff --git a/graphql/codegen/src/cli/shared.ts b/graphql/codegen/src/cli/shared.ts index d9fa87151..9762e62e5 100644 --- a/graphql/codegen/src/cli/shared.ts +++ b/graphql/codegen/src/cli/shared.ts @@ -26,6 +26,7 @@ export interface CodegenAnswers { apiNames?: string[]; reactQuery?: boolean; orm?: boolean; + browserCompatible?: boolean; authorization?: string; dryRun?: boolean; verbose?: boolean; @@ -85,6 +86,14 @@ export const codegenQuestions: Question[] = [ default: false, useDefault: true, }, + { + name: 'browserCompatible', + message: 'Generate browser-compatible code?', + type: 'confirm', + required: false, + default: true, + useDefault: true, + }, { name: 'authorization', message: 'Authorization header value', From c2f8e74505b88a38e97e380711d079adcad6fe04 Mon Sep 17 00:00:00 2001 From: ghou9khub Date: Mon, 26 Jan 2026 19:02:22 -0800 Subject: [PATCH 2/2] Add browserCompatible to cnc as well --- packages/cli/src/commands/codegen.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cli/src/commands/codegen.ts b/packages/cli/src/commands/codegen.ts index 006e78c6f..7cdef8e1f 100644 --- a/packages/cli/src/commands/codegen.ts +++ b/packages/cli/src/commands/codegen.ts @@ -26,6 +26,8 @@ Generator Options: --orm Generate ORM client --output Output directory (default: codegen) --authorization Authorization header value + --browserCompatible Generate browser-compatible code (default: true) + Set to false for Node.js with localhost DNS fix --dryRun Preview without writing files --verbose Verbose output @@ -68,6 +70,7 @@ export default async ( authorization: answers.authorization, reactQuery: answers.reactQuery, orm: answers.orm, + browserCompatible: answers.browserCompatible, dryRun: answers.dryRun, verbose: answers.verbose, });