Docs: Add --debug-build-paths next build option (#85097)

Related: https://github.com/vercel/next.js/pull/85052
This commit is contained in:
Delba de Oliveira
2025-10-20 14:40:00 +01:00
committed by GitHub
parent 27862f0065
commit 02c9a7ede4
@@ -84,6 +84,7 @@ The following options are available for the `next build` command:
| `--experimental-app-only` | Builds only App Router routes. |
| `--experimental-build-mode [mode]` | Uses an experimental build mode. (choices: "compile", "generate", default: "default") |
| `--debug-prerender` | Debug prerender errors in development. |
| `--debug-build-paths=<patterns>` | Build only specific routes for debugging. |
### `next start` options
@@ -205,6 +206,22 @@ This helps surface more readable stack traces and code frames in the build outpu
> **Warning**: `--debug-prerender` is for debugging in development only. Do not deploy builds generated with `--debug-prerender` to production, as it may impact performance.
### Building specific routes
You can build only specific routes in the App and Pages Routers using the `--debug-build-paths` option. This is useful for faster debugging when working with large applications. The `--debug-build-paths` option accepts comma-separated file paths and supports glob patterns:
```bash filename="Terminal"
# Build a specific route
next build --debug-build-paths="app/page.tsx"
# Build more than one route
next build --debug-build-paths="app/page.tsx,pages/index.tsx"
# Use glob patterns
next build --debug-build-paths="app/**/page.tsx"
next build --debug-build-paths="pages/*.tsx"
```
### Changing the default port
By default, Next.js uses `http://localhost:3000` during development and with `next start`. The default port can be changed with the `-p` option, like so: