1.8 KiB
1.8 KiB
Next.js dev-server recipe (auto-detect fallback)
Loaded when detect-project-type.sh returns next and there is no .claude/launch.json to consult.
Signature
next.config.js,next.config.mjs,next.config.ts, ornext.config.cjsexistspackage.jsoncontains anextdependency
Start command
Standard:
npm run dev
Also valid (read package.json scripts to confirm which the project uses):
pnpm dev
yarn dev
bun run dev
Prefer the package manager indicated by the lockfile:
pnpm-lock.yaml->pnpm devyarn.lock->yarn devbun.lock/bun.lockb->bun run devpackage-lock.jsonor none ->npm run dev
Port
Default: 3000. Next.js respects -p <port> / --port <port> and the PORT env var. Overrides follow the cascade in references/dev-server-detection.md.
Turbopack
Next.js 14+ supports --turbo (and 15+ makes it default). If the dev script in package.json includes --turbo, preserve it. Turbopack changes reload behavior but not port or URL conventions.
Stub generation
{
"version": "0.2.0",
"configurations": [
{
"name": "Next dev",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"port": 3000
}
]
}
Substitute the resolved package manager (npm / pnpm / yarn / bun) and port.
Common gotchas
- App Router vs Pages Router: dev-server behavior is the same; polish doesn't care. Checklist generation (Unit 5) does — pages in
app/andpages/are different surfaces. - Monorepo roots: in a pnpm/Turborepo monorepo,
npm run devat the root typically fans out to multiple packages. Users should setcwdin.claude/launch.jsonto the specific Next app (cwd: "apps/web"). - Env loading:
.env.localis loaded automatically by Next; polish does not need to export it.