Fix incremental build serving cached HTML with stale CSS filenames after stylesheet-only edits - #17705
Merged
Conversation
…ale cache hits (#17704)\n\nCSS modules have empty `code` in Vite's prerender bundle because their\ncontent is extracted into separate assets. The incremental build's\n`hashModules()` was hashing only the (empty) bundle code, so CSS edits\nnever changed the dependency hash and cached pages kept referencing\nstale CSS filenames.\n\nWhen a module's code is empty and its ID matches a CSS file pattern,\nread the source file from disk and hash its contents instead."
1 task
🦋 Changeset detectedLatest commit: ae18f04 The changes in this PR will be included in the next version bump. This PR includes changesets to release 420 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will improve performance by 14.96%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | Build: hybrid site (static + server) |
1.6 s | 1.4 s | +18.14% |
| ⚡ | Simulation | Rendering: streaming [true], .md file |
1.4 ms | 1.3 ms | +11.87% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing triagebot/fix-17704 (ae18f04) with main (414fe28)1
Footnotes
matthewp
approved these changes
Aug 19, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
code— Vite extracts their content into separate assets, leaving the module'scodeas"". BecausehashModules()was skipping modules with no code, CSS edits never changed the dependency hash andcanSkip()incorrectly returnedtrue, restoring cached HTML that referenced the old, now-missing_astro/*.cssfilename.CSS_LANGS_RE,hashModules()now reads the source file from disk and includes its contents in the hash. CSS edits now produce a different dependency hash, causing affected pages to re-render with the correct stylesheet reference.Closes #17704
Testing
plugin-incremental.test.tsunderCSS modules (#17704): one that asserts the hash changes when the CSS file is modified on disk, and one that asserts the hash is stable when the file is unchanged.Docs
experimental.incrementalBuild, which is not yet documented beyond the config reference.