Skip to content

Commit 06309d9

Browse files
committed
fix(showcase/shell-docs): next.config build detection uses NEXT_PHASE
Replace the argv-sniffing 'process.argv.includes("build")' check with process.env.NEXT_PHASE === "phase-production-build", the Next.js canonical signal for a production build. The argv approach is fragile: it breaks under wrappers, programmatic invocation, or any tool that invokes next via a different argv shape.
1 parent e637a17 commit 06309d9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

showcase/shell-docs/next.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import type { NextConfig } from "next";
99
// config (e.g. `next lint`, `next dev`) only warn, because failing them on a
1010
// missing value would be noise — consumers are expected to handle the dev
1111
// fallback themselves (e.g. `process.env.NEXT_PUBLIC_BASE_URL ?? "http://localhost:3003"`).
12-
const isNextBuild = process.argv.includes("build");
12+
//
13+
// Use NEXT_PHASE — the Next.js-canonical signal for production builds —
14+
// rather than sniffing process.argv, which is fragile (e.g. broken under
15+
// wrappers, turbo runs, or when invoked programmatically).
16+
const isNextBuild = process.env.NEXT_PHASE === "phase-production-build";
1317

1418
if (!process.env.NEXT_PUBLIC_BASE_URL) {
1519
if (isNextBuild) {

0 commit comments

Comments
 (0)