From adf7a30ec0dfd893517ee3a8abb9a9b28a836720 Mon Sep 17 00:00:00 2001 From: Vincent Voyer Date: Fri, 13 Mar 2020 10:07:37 +0100 Subject: [PATCH] fix(debugging): do not pass NODE_OPTIONS='--inspect' to subprocesses fixes #11030 --- packages/next/server/next-dev-server.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/next/server/next-dev-server.ts b/packages/next/server/next-dev-server.ts index a8450ca036891b..7dd9fb5c84fac2 100644 --- a/packages/next/server/next-dev-server.ts +++ b/packages/next/server/next-dev-server.ts @@ -85,6 +85,16 @@ export default class DevServer extends Server { { maxRetries: 0, numWorkers: this.nextConfig.experimental.cpus, + forkOptions: { + env: { + ...process.env, + // discard process.env.NODE_OPTIONS --inspect flag otherwise two debuggers are started in inspect + // mode when users will try to debug their Next.js application with NODE_OPTIONS='--inspect' next dev + NODE_OPTIONS: process.env.NODE_OPTIONS + ? process.env.NODE_OPTIONS.replace('--inspect', '') + : '', + }, + }, } ) as Worker & { loadStaticPaths: typeof import('./static-paths-worker').loadStaticPaths