← Back to all briefs
Performance52s read

Astro 7.2 Adds Incremental Static Builds, Only Changed Pages Re-Render

Astro 7.2's experimental incremental builds reuse unchanged pages across runs, so large static sites stop re-rendering thousands of slug routes for every content edit.

Astro 7.2 shipped August 6 with experimental incremental static builds. Set experimental.incrementalBuild: true in astro.config.mjs. Routes opt in by returning a cacheKey per path from getStaticPaths(); for content collections, entry.digest is the recommended key. A page reuses its previous output only when both the module-graph hash and the cacheKey match. Paths without a cacheKey always render, so existing builds behave exactly as before.

The payoff: a few [...slug].astro routes generating thousands of pages means one content edit re-renders the whole site today. With incremental builds, only pages whose content changed go through HTML generation again, the slowest phase left after Astro 7's bundling improvements. You stop burning CI minutes on unchanged pages.

The cache lives in cacheDir, defaulting to node_modules/.astro/. Persist that directory in CI and you get cross-run reuse without new config.

Elsewhere in 7.2: session: false opts out of the session runtime, letting the Cloudflare, Netlify, and Node adapters tree-shake it when you have no driver. astro preview --background adds status, logs, and stop commands for scripted previews, and logger entrypoints accept relative paths. Upgrade with npx @astrojs/upgrade.