From 52e0b1d1ef1e82ff9971d44e0f8324804df9d52c Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Sat, 26 Aug 2023 21:22:30 -0400 Subject: [PATCH] Fix router CPU profiling (#54497) Since we've merged the app and router processes, the `__NEXT_PRIVATE_CPU_PROFILE` env was missing. --- packages/next/src/server/lib/start-server.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/next/src/server/lib/start-server.ts b/packages/next/src/server/lib/start-server.ts index 0f78b15d6ef68..661bcd8701842 100644 --- a/packages/next/src/server/lib/start-server.ts +++ b/packages/next/src/server/lib/start-server.ts @@ -18,6 +18,11 @@ import { import { checkIsNodeDebugging } from './is-node-debugging' const debug = setupDebug('next:start-server') +if (process.env.NEXT_CPU_PROF) { + process.env.__NEXT_PRIVATE_CPU_PROFILE = `CPU.router` + require('./cpu-profile') +} + export interface StartServerOptions { dir: string port: number