Next.js Tooling
Priority: P2 (MEDIUM)
Structure
project/
├── .next/ # Build artifacts
├── next.config.js # Advanced config
└── .eslintrc.json # Next plugins
Implementation Guidelines
- Build Architecture: Use
Turbopack(modern) orWebpack(legacy). Enable--turbofor faster incremental development. - Minification: Ensure
output: 'standalone'is set innext.config.jsfor optimized Docker deployments. UseProGuard/Uglifyequivalents for asset shrinking. - Linting: Mandate
next lint(Next.js ESLint plugin) andtsc(typecheck) in CI/CD pipelines. - Asset Optimization: Inspect size with
@next/bundle-analyzer. Optimize images vianext/imageand remove unused dependencies. - Telemetry: Opt-out via
next telemetry disableif privacy is required. - Environment: Use
.envmanagement in Next.js (Server only vsNEXT_PUBLIC_*). Validate schemas with Zod at runtime. - CI/CD: Cache the
.next/cachefolder in CI for 50%+ faster build times.
Anti-Patterns
- No
npm run startfor dev: Usenext dev(ornext dev --turbo). - No uninspected bundle growth: Analyze with
@next/bundle-analyzerbefore shipping. - No custom ESLint rules over plugin: Use
eslint-plugin-nextfor Next.js-aware linting. - No
console.login production: Use structured loggers (Pino, Winston).
References
- CI/CD & Deployment Guide