diff --git a/packages/server/scripts/dev-runner.ts b/packages/server/scripts/dev-runner.ts index 6cef37140..639492988 100644 --- a/packages/server/scripts/dev-runner.ts +++ b/packages/server/scripts/dev-runner.ts @@ -8,21 +8,8 @@ dotenv.config({ }); const daemonRunnerEntry = fileURLToPath(new URL("./supervisor-entrypoint.ts", import.meta.url)); -const inspectArg = process.env.PASEO_NODE_INSPECT ?? "--inspect"; -const inspectArgs = - inspectArg === "0" || inspectArg === "false" || inspectArg === "off" ? [] : [inspectArg]; -const supervisorArgs = [ - ...inspectArgs, - "--heapsnapshot-near-heap-limit=3", - "--max-old-space-size=3072", - "--report-on-fatalerror", - "--report-directory=/tmp/paseo-reports", - ...process.execArgv, - daemonRunnerEntry, - "--dev", - ...process.argv.slice(2), -]; +const supervisorArgs = [...process.execArgv, daemonRunnerEntry, "--dev", ...process.argv.slice(2)]; const supervisor = spawn(process.execPath, supervisorArgs, { stdio: "inherit", diff --git a/packages/server/scripts/supervisor-entrypoint.ts b/packages/server/scripts/supervisor-entrypoint.ts index ea5b5505c..bf8b3c67d 100644 --- a/packages/server/scripts/supervisor-entrypoint.ts +++ b/packages/server/scripts/supervisor-entrypoint.ts @@ -58,8 +58,22 @@ function resolveDevWorkerEntry(): string { return candidate; } -function resolveWorkerExecArgv(workerEntry: string): string[] { - return workerEntry.endsWith(".ts") ? ["--import", "tsx"] : []; +function resolveWorkerExecArgv(workerEntry: string, devMode: boolean): string[] { + const execArgv = workerEntry.endsWith(".ts") ? ["--import", "tsx"] : []; + if (!devMode) { + return execArgv; + } + const devArgs = [ + "--heapsnapshot-near-heap-limit=3", + "--max-old-space-size=3072", + "--report-on-fatalerror", + "--report-directory=/tmp/paseo-reports", + ]; + const inspectArg = process.env.PASEO_NODE_INSPECT ?? "--inspect"; + if (inspectArg !== "0" && inspectArg !== "false" && inspectArg !== "off") { + devArgs.push(inspectArg); + } + return [...devArgs, ...execArgv]; } function resolvePackagedNodeEntrypointRunnerPath(currentScriptPath: string): string | null { @@ -77,7 +91,7 @@ function resolvePackagedNodeEntrypointRunnerPath(currentScriptPath: string): str async function main(): Promise { const config = parseConfig(process.argv.slice(2)); const workerEntry = config.devMode ? resolveDevWorkerEntry() : resolveWorkerEntry(); - const workerExecArgv = resolveWorkerExecArgv(workerEntry); + const workerExecArgv = resolveWorkerExecArgv(workerEntry, config.devMode); const workerEnv: NodeJS.ProcessEnv = { ...process.env }; const packagedNodeEntrypointRunner = process.env.ELECTRON_RUN_AS_NODE === "1"