Skip to content

Conversation

@simensfo
Copy link

@simensfo simensfo commented Oct 23, 2025

Changes

resolves #14604
resolves withastro/starlight#3497

reintroduces css deduplication for hydrated client components. fixes the issue that causes stylesheets imported using the ?url or ?no-inline suffix to be flagged as orphaned, and thus removed from the build output

fix:

  • assets referenced in viteMetadata.importedAssets in a chunk are no longer flagged as orphaned by the inlineStylesheets plugin

Testing

added a new test that imports a stylesheet using the ?url and ?no-inline suffixes, ensuring the asset is included in the build output and referenced in the page

Docs

added a comment explaining the updated isOrphaned logic

@changeset-bot
Copy link

changeset-bot bot commented Oct 23, 2025

🦋 Changeset detected

Latest commit: 9d7ccd2

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

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 Oct 23, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 23, 2025

CodSpeed Performance Report

Merging #14607 will not alter performance

Comparing simensfo:fix/url-imports (9d7ccd2) with main (18552c7)1

Summary

✅ 6 untouched

Footnotes

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

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! Will this also work for other queries or just ?url? For example, Starlight uses ?url&no-inline: https://github.com/withastro/starlight/blob/1c3d999e05e7fea210881145efaa65f8ad837c57/packages/starlight/components/Page.astro#L32 (related bug report: withastro/starlight#3497)

@simensfo
Copy link
Author

Thanks for looking into this! Will this also work for other queries or just ?url? For example, Starlight uses ?url&no-inline: https://github.com/withastro/starlight/blob/1c3d999e05e7fea210881145efaa65f8ad837c57/packages/starlight/components/Page.astro#L32 (related bug report: withastro/starlight#3497)

Yes, it seems to be the same issue. i added a new case checking ?url&no-inline

@simensfo
Copy link
Author

looks like it works now, but i really don't know if importedAssets is the right place to check. also the extra looping through the bundle feels bad

@simensfo simensfo marked this pull request as ready for review October 24, 2025 08:00
@MortenOftedal
Copy link

Any reviewers on this? I like css deduplication

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

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Astro is not building print.css which is referenced in the head ?url imports are excluded from build with Astro 5.14.7 or higher

3 participants