Fixes
optimizeCssrenames each pruned CSS file whose name hashes its content (assets/index-[hash].css) to a hash of the pruned CSS, and updates the HTML, chunks and Vite manifest that name it; chunks that preload CSS change names with the pruning too. Before, two builds that pruned differently could write different CSS under one name, so with long-lived caching (Cache-Control: immutable) returning visitors could get the old CSS and miss styles (#318).
Adding one safelist entry to an app that lazy-loads a component:
| Build | Entry JS | Lazy JS | CSS |
|---|---|---|---|
| Before | index-BtL7hTFi.js
| Lazy-BPJz1njo.js
| index-V0ZrfRHH.css
|
| Identical rebuild | same | same | same |
With the new safelist entry
| index-CQ_n37s1.js
| Lazy-UzNhWRrJ.js
| index-Tx0tbVZe.css
|
Under Vite, it now prunes before other plugins' generateBundle, so Vite's HTML and Astro's pages link the renamed files. Not covered: Vite with cssCodeSplit: false, the optimize-css CLI, and webpack with optimization.realContentHash: false keep their file names, so don't cache those as immutable. Webpack and Rspack in production mode already pruned before hashing.
If you serve /assets/* with Cache-Control: immutable, upgrade to this release.