Next.js › Turbopack & Build Performance

What broader build performance optimizations, beyond just switching bundlers, can help speed up a large Next.js project's build times?

Advanced

Answer

You can reduce the amount of code that needs to be processed by removing unused dependencies, split very large pages into smaller more focused components, use incremental static regeneration instead of building every page eagerly at build time, and take advantage of build caching provided by your deployment platform.
// Avoid pre-building every single page eagerly
// Use ISR to generate less critical pages on demand instead
export const dynamicParams = true;
Real-world example A large marketplace with tens of thousands of product pages significantly reduces its total build time by pre-building only its most popular pages and letting the rest generate on demand using incremental static regeneration.

Common follow-ups: How does build caching on a hosting platform like Vercel help speed up deployments?;What is the tradeoff between building every page eagerly versus generating some on demand?