diff --git a/packages/nextjs/src/client/index.ts b/packages/nextjs/src/client/index.ts index 4d09e7e2d170..4c52e7cfd648 100644 --- a/packages/nextjs/src/client/index.ts +++ b/packages/nextjs/src/client/index.ts @@ -77,8 +77,7 @@ export function init(options: BrowserOptions): Client | undefined { } try { - // @ts-expect-error `process.turbopack` is a magic string that will be replaced by Next.js - if (process.turbopack) { + if (process.env.TURBOPACK) { getGlobalScope().setTag('turbopack', true); } } catch { diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index 7982667f0c3f..19540618f2aa 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -95,8 +95,7 @@ export function init(options: VercelEdgeOptions = {}): void { }); try { - // @ts-expect-error `process.turbopack` is a magic string that will be replaced by Next.js - if (process.turbopack) { + if (process.env.TURBOPACK) { getGlobalScope().setTag('turbopack', true); } } catch { diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index 82d475a719c6..b57cb09eda76 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -368,8 +368,7 @@ export function init(options: NodeOptions): NodeClient | undefined { } try { - // @ts-expect-error `process.turbopack` is a magic string that will be replaced by Next.js - if (process.turbopack) { + if (process.env.TURBOPACK) { getGlobalScope().setTag('turbopack', true); } } catch {