Capítulo 432 de 456
Reference for the next CLI: dev, build, start, info, telemetry, typegen, upgrade, and experimental-analyze commands.
dev, build, start, info, telemetry, typegen, upgrade, experimental-analyze. Running next with no command aliases to next dev.next dev: dev server with HMR; outputs to .next/dev (separate from .next, so dev and build can run concurrently). Key flags: --turbopack (default), --webpack, -p/--port, -H/--hostname, --experimental-https(-key/-cert/-ca), --experimental-cpu-prof.next build: production build; key flags: --turbopack/--webpack, -d/--debug, --profile, --no-mangling, --experimental-app-only, --debug-prerender, --debug-build-paths=<patterns>.next start: runs production build (requires prior next build); --keepAliveTimeout for downstream proxy tuning.next info: prints OS/binaries/package versions for bug reports; --verbose for more detail.next typegen: generates route TypeScript definitions without a full build; output to <distDir>/types; also regenerates next-env.d.ts.next upgrade: upgrades the app to latest/specified version via --revision <revision>.next experimental-analyze: analyzes bundle output via Turbopack; -o/--output writes static files to .next/diagnostics/analyze without starting a server; no build artifacts produced.next build --debug-build-paths="app/**/page.tsx,!app/admin/**"
!.next typegen && tsc --noEmit
NODE_OPTIONS='--inspect' next
next.| Command | Description |
|---|---|
dev | Dev mode with HMR, error reporting. |
build | Optimized production build; shows per-route info. |
start | Production mode (needs prior next build). |
info | System details for bug reports. |
telemetry | Enable/disable anonymous telemetry. |
typegen | Generate TS route definitions without full build. |
upgrade | Upgrade to latest/specified Next.js version. |
experimental-analyze | Analyze bundle output via Turbopack (no build artifacts). |
| Version | Changes |
|---|---|
v16.1.0 | Added next upgrade and next experimental-analyze. |
v16.0.0 | Removed JS bundle size metrics from next build output. |
v15.5.0 | Added next typegen. |
v15.4.0 | Added --debug-prerender for next build. |
--debug-prerender: desativa minificação server-side e gera source maps, impactando performance; só pra debug local.PORT via .env: não funciona, o servidor HTTP sobe antes de qualquer código ser inicializado; use -p ou variável de ambiente na chamada.next dev/next build podem rodar simultaneamente porque escrevem em pastas diferentes (.next/dev vs .next).npm run, use -- antes das flags do CLI pra repassar corretamente (não necessário com pnpm/yarn/bun).--experimental-cpu-prof grava perfis .cpuprofile em .next-profiles/, abríveis no Chrome DevTools.next typegen roda a config de produção; garanta env vars/dependências disponíveis pra config carregar.typedRoutes depende de next typegen/next dev/next build.next lint foi removido; use ESLint CLI diretamente em vez de um subcomando next.