From 6001b934dbd582c2c294d05839da004ec0c17b4b Mon Sep 17 00:00:00 2001 From: Pieter Berkel Date: Thu, 25 Sep 2025 11:22:29 +0200 Subject: [PATCH 1/4] docs: improve instrumentation example --- apps/content/docs/adapters/next.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/content/docs/adapters/next.md b/apps/content/docs/adapters/next.md index 0cc422b16..8efca391b 100644 --- a/apps/content/docs/adapters/next.md +++ b/apps/content/docs/adapters/next.md @@ -164,7 +164,14 @@ globalThis.$client = createRouterClient(router, { ```ts [instrumentation.ts] export async function register() { + // Option 1: Simple global import (works with both Edge and Node.js runtimes) await import('./lib/orpc.server') + + // Option 2: Conditional import (only when using Node.js specific features) + // Use this if your server-side client uses Node.js APIs like fs, crypto, etc. + // if (process.env.NEXT_RUNTIME === "nodejs") { + // await import('./lib/orpc.server') + // } } ``` From 36080fd70a02e89c773981cd4968bf9b2a328351 Mon Sep 17 00:00:00 2001 From: unnoq Date: Thu, 25 Sep 2025 16:50:53 +0700 Subject: [PATCH 2/4] improve --- apps/content/docs/adapters/next.md | 8 ++------ apps/content/docs/best-practices/optimize-ssr.md | 3 +++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/content/docs/adapters/next.md b/apps/content/docs/adapters/next.md index 8efca391b..c013769fe 100644 --- a/apps/content/docs/adapters/next.md +++ b/apps/content/docs/adapters/next.md @@ -164,13 +164,9 @@ globalThis.$client = createRouterClient(router, { ```ts [instrumentation.ts] export async function register() { - // Option 1: Simple global import (works with both Edge and Node.js runtimes) - await import('./lib/orpc.server') - - // Option 2: Conditional import (only when using Node.js specific features) - // Use this if your server-side client uses Node.js APIs like fs, crypto, etc. + // Conditionally import if needed // if (process.env.NEXT_RUNTIME === "nodejs") { - // await import('./lib/orpc.server') + await import('./lib/orpc.server') // } } ``` diff --git a/apps/content/docs/best-practices/optimize-ssr.md b/apps/content/docs/best-practices/optimize-ssr.md index f2b76adf3..23f80e4e0 100644 --- a/apps/content/docs/best-practices/optimize-ssr.md +++ b/apps/content/docs/best-practices/optimize-ssr.md @@ -143,7 +143,10 @@ Finally, ensure `lib/orpc.server.ts` is imported before any other code on the se ```ts [instrumentation.ts] export async function register() { + // Conditionally import if needed + // if (process.env.NEXT_RUNTIME === "nodejs") { await import('./lib/orpc.server') + // } } ``` From 00cf740e331c29859491db661ba2358aaca560cb Mon Sep 17 00:00:00 2001 From: unnoq Date: Thu, 25 Sep 2025 17:34:57 +0700 Subject: [PATCH 3/4] improve --- apps/content/docs/adapters/next.md | 2 +- apps/content/docs/best-practices/optimize-ssr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/content/docs/adapters/next.md b/apps/content/docs/adapters/next.md index c013769fe..6daf4c18d 100644 --- a/apps/content/docs/adapters/next.md +++ b/apps/content/docs/adapters/next.md @@ -164,7 +164,7 @@ globalThis.$client = createRouterClient(router, { ```ts [instrumentation.ts] export async function register() { - // Conditionally import if needed + // Conditionally import if multiple runtimes (Node.js/Edge) compatibility is required // if (process.env.NEXT_RUNTIME === "nodejs") { await import('./lib/orpc.server') // } diff --git a/apps/content/docs/best-practices/optimize-ssr.md b/apps/content/docs/best-practices/optimize-ssr.md index 23f80e4e0..2929854d7 100644 --- a/apps/content/docs/best-practices/optimize-ssr.md +++ b/apps/content/docs/best-practices/optimize-ssr.md @@ -143,7 +143,7 @@ Finally, ensure `lib/orpc.server.ts` is imported before any other code on the se ```ts [instrumentation.ts] export async function register() { - // Conditionally import if needed + // Conditionally import if multiple runtimes (Node.js/Edge) compatibility is required // if (process.env.NEXT_RUNTIME === "nodejs") { await import('./lib/orpc.server') // } From 1031e8b6022ebbe42f0f787260df4c6648b18898 Mon Sep 17 00:00:00 2001 From: unnoq Date: Thu, 25 Sep 2025 17:46:36 +0700 Subject: [PATCH 4/4] improve --- apps/content/docs/adapters/next.md | 2 +- apps/content/docs/best-practices/optimize-ssr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/content/docs/adapters/next.md b/apps/content/docs/adapters/next.md index 6daf4c18d..06ee9bc84 100644 --- a/apps/content/docs/adapters/next.md +++ b/apps/content/docs/adapters/next.md @@ -164,7 +164,7 @@ globalThis.$client = createRouterClient(router, { ```ts [instrumentation.ts] export async function register() { - // Conditionally import if multiple runtimes (Node.js/Edge) compatibility is required + // Conditionally import if facing runtime compatibility issues // if (process.env.NEXT_RUNTIME === "nodejs") { await import('./lib/orpc.server') // } diff --git a/apps/content/docs/best-practices/optimize-ssr.md b/apps/content/docs/best-practices/optimize-ssr.md index 2929854d7..e62f1905e 100644 --- a/apps/content/docs/best-practices/optimize-ssr.md +++ b/apps/content/docs/best-practices/optimize-ssr.md @@ -143,7 +143,7 @@ Finally, ensure `lib/orpc.server.ts` is imported before any other code on the se ```ts [instrumentation.ts] export async function register() { - // Conditionally import if multiple runtimes (Node.js/Edge) compatibility is required + // Conditionally import if facing runtime compatibility issues // if (process.env.NEXT_RUNTIME === "nodejs") { await import('./lib/orpc.server') // }