-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Labels
- P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)An edge case that only affects very specific usage, but has a trivial workaround (priority)feat: assetsRelated to the Assets feature (scope)Related to the Assets feature (scope)
Description
Astro Info
Astro v5.10.0
Node v20.19.1
System Linux (x64)
Package Manager pnpm
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
JSON.stringify does not work for SVG image objects (ImageMetadata) since Astro 5.7.0, possibly due to commit 406501a which unflagged the SVG component feature and added extra properties to SVG image objects.
For example, the following code (see Minimal Reproducible Example) works in Astro 5.6.2 but not 5.7.0 and later versions:
import svgimage from '../assets/astro.svg';
console.log("SVG Image JSON:", JSON.stringify(svgimage));
// 5.6.2: {"src":"...", ...}
// 5.10.0: undefined
The bug also breaks pages where content collection entries with images are serialized.
To reproduce:
- Go the Minimal Reproducible Example
- Run
pnpm install - Run
pnpm run astro build --verbose - Check the output
For expected result, replace pnpm install with pnpm install [email protected].
What's the expected result?
JSON.stringify should output a serialized string as in the version 5.6.2.
Link to Minimal Reproducible Example
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)An edge case that only affects very specific usage, but has a trivial workaround (priority)feat: assetsRelated to the Assets feature (scope)Related to the Assets feature (scope)