fix(assets): prevent circular dependency deadlock with SVG in content collections#15603
Merged
Princesseuh merged 5 commits intoFeb 26, 2026
Merged
fix(assets): prevent circular dependency deadlock with SVG in content collections#15603Princesseuh merged 5 commits into
Princesseuh merged 5 commits into
Conversation
…content collections (#15575) When SVG images are used in content collection `image()` fields combined with top-level await (TLA), the build would silently exit due to a circular module dependency deadlock. SVGs were being converted to full Astro components (importing `createComponent` from the server runtime) even when only metadata was needed for content collection data. The fix preserves the `astroContentImageFlag` through the Vite resolution pipeline so that the `astro:assets:esm` plugin can detect content collection SVGs and return plain `ImageMetadata` instead of creating full components, breaking the circular dependency chain. Co-Authored-By: Claude Opus 4.6 <[email protected]>
🦋 Changeset detectedLatest commit: 7568f86 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 |
Contributor
|
Looks pretty good! Can you add a changeset? |
Contributor
Author
No problem, I'll try to do this this sunday (I hope). |
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
Author
Should be good now, hope you'll like it |
astrochemx
reviewed
Feb 22, 2026
astrochemx
reviewed
Feb 22, 2026
ematipico
reviewed
Feb 23, 2026
ematipico
left a comment
Member
There was a problem hiding this comment.
It looks good. I would like to rephrase the changeset to make it more end-user-friendly, and we could apply the small optimisation
- Reword changeset to be more end-user-friendly - Mutate resolved.id directly instead of spreading a new object Co-Authored-By: Claude Opus 4.6 <[email protected]>
Princesseuh
approved these changes
Feb 25, 2026
Merged
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.
Summary
Fixes #15575
astroContentImageFlagthrough the Vite resolution pipeline invite-plugin-content-assets.tsso downstream plugins can detect content collection imagesImageMetadatafor content collection SVGs invite-plugin-assets.tsinstead of creating full Astro components (which importcreateComponentfrom the server runtime and cause a circular module dependency deadlock with TLA)Root Cause
When SVG images are used in content collection
image()fields:content-assets.mjsimports them with?astroContentImageFlagmakeSvgComponent()which imports fromruntime/server/index.jsFix
The
astroContentImageFlagis now preserved through resolution so the assets plugin can distinguish content collection SVGs (which only need metadata) from directly imported SVGs (which need full component rendering).Test plan
content-collection-tla-svg.test.js(YAML collection + SVGimage()field + TLA withgetCollection)core-imagetests pass (100/100)core-image-svgtests pass (11/11)content-layertests pass (59/59)🤖 Generated with Claude Code