Experimental Astro incremental static builds

Astro 실험적 증분 정적 빌드

Astro 7.2 skips HTML generation for static paths whose code and data are unchanged.

···
html
<section class="stage"><div class="heading">INCREMENTAL BUILD <span class="hint">code hash + data key</span></div><div class="build-grid"><div class="build-page"><b>PAGE A</b><span>same</span></div><div class="build-page"><b>PAGE B</b><span>changed</span></div><div class="build-page"><b>PAGE C</b><span>same</span></div></div><div class="build-status" id="build-status">Compare previous build keys</div><div class="caption">Only changed paths need another render</div></section>
css
.stage{width:min(94vw,780px);height:min(88vh,322px);padding:clamp(12px,3vmin,20px);border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 12px 36px #0001;display:flex;flex-direction:column;gap:clamp(7px,2vmin,14px);font:500 clamp(12px,3.5vmin,17px)/1.3 var(--font-sans,system-ui,sans-serif);overflow:hidden}.heading{display:flex;justify-content:space-between;align-items:center;gap:8px;font-weight:750;color:var(--accent)}.hint{color:var(--muted);font-size:clamp(12px,3.2vmin,14px);font-weight:500}.caption{margin-top:auto;color:var(--muted);font-size:clamp(12px,3.2vmin,14px)}.row{display:flex;gap:clamp(5px,1.5vmin,12px);align-items:center}.tile{padding:clamp(6px,1.8vmin,13px);border:1px solid var(--line);border-radius:9px;background:var(--bg);text-align:center;min-width:0}.arrow{color:var(--accent);font-weight:800}.stage [data-on]{transition:background .3s,border-color .3s,opacity .3s,transform .3s}.stage .on{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,var(--surface));color:var(--accent)}.build-grid{flex:1;display:flex;align-items:stretch;justify-content:center;gap:clamp(5px,2vmin,15px);min-height:70px}.build-page{flex:1;max-width:150px;border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:clamp(5px,1.7vmin,10px);display:flex;flex-direction:column;justify-content:space-between;text-align:center;transition:background .3s,border-color .3s}.build-page b{font-size:clamp(12px,3vmin,15px)}.build-page span{font-size:clamp(12px,3vmin,14px);color:var(--muted)}.stage[data-step="1"] .build-page:not(:nth-child(2)),.stage[data-step="2"] .build-page:not(:nth-child(2)){border-color:var(--accent-2)}.stage[data-step="1"] .build-page:not(:nth-child(2)) span,.stage[data-step="2"] .build-page:not(:nth-child(2)) span{color:var(--accent-2)}.stage[data-step="2"] .build-page:nth-child(2){border-color:var(--accent);background:color-mix(in srgb,var(--accent) 18%,var(--surface))}.build-status{text-align:center;color:var(--accent-2);font-weight:700;font-size:clamp(12px,3vmin,15px)}.stage small,.stage button,.stage .cards b,.stage .phase b,.stage .pair b,.stage .tree-mini b{font-size:clamp(12px,3.2vmin,14px)!important}
js
const stage=document.querySelector(".stage"),status=document.getElementById("build-status"),labels=["Compare previous build keys","A and C: reuse stored HTML","B: render new HTML"];let step=0;function tick(){stage.dataset.step=String(step);status.textContent=labels[step];step=(step+1)%3}tick();const timer=setInterval(tick,1000);stage.addEventListener("pointerdown",()=>{clearInterval(timer);tick()})

Astro 7.2 experimental incremental static builds compare a cacheKey from getStaticPaths() with a hash of the route code dependencies. When both match the previous build, Astro reuses the stored HTML.

Unlike request-time ISR, this reduces work during the next build. Missing cacheDir data or a changed data key triggers rendering again; the feature remains experimental.

When to use

Evaluate it for large Astro static sites where only a small share of pages changes between builds.

Open as page ↗