Skip to content

Resolve volatile asset placeholders before hashing CSS in incremental builds - #18062

Closed
astro-factory[bot] wants to merge 1 commit into
mainfrom
factory/fix-18058
Closed

astro-factory[bot] wants to merge 1 commit into
mainfrom
factory/fix-18058

Conversation

@astro-factory

@astro-factory astro-factory Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Pages whose CSS references emitted assets (fonts, images via url()) now restore reliably on subsequent incremental builds instead of non-deterministically re-rendering. Vite's transform output for such CSS contains __VITE_ASSET__<handle>__ placeholders where handles are assigned per-build and are not stable across runs. The compiled CSS branch in hashModules() was passing this raw output directly to the hasher, making dependencyHash change every build even when no source file changed.
  • The fix calls resolveAssetPlaceholders(graph, compiled) on the compiled CSS before hashing, replacing volatile placeholders with their stable content-hashed filenames — matching the treatment already applied to the non-CSS module code path.

Testing

  • Extended packages/astro/test/units/build/plugin-incremental.test.ts to cover the CSS-with-emitted-asset case: a route importing a stylesheet that references a font above the inline threshold should produce the same dependencyHash across consecutive builds, regardless of the per-build asset handle assigned by the bundler.

Docs

  • No docs update needed; this is an internal correctness fix for an existing experimental feature with no API surface change.

Closes #18058

@astro-factory astro-factory Bot added the fix verified Reporter confirmed the triage bot fix works label Sep 18, 2026
@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c5ebeea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Patch

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

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label Sep 18, 2026
@codspeed

codspeed Bot commented Sep 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing factory/fix-18058 (c5ebeea) with main (cf5d72f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (db2eaf1) during the generation of this report, so cf5d72f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@adamchal

Copy link
Copy Markdown
Member

This fixes the CSS reference but this is still an issue with imported assets in .astro templates…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified Reporter confirmed the triage bot fix works pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incrementalBuild never reuses pages

1 participant