Skip to content

New astro assets images pipeline should deduplicate images with identical props #8047

@mastfissh

Description

@mastfissh

What version of astro are you using?

2.8.0

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

What browser are you using?

N/A

Describe the Bug

I have two components that display the same image on different pages.

One of them uses GetImage, and one of them uses the Image component. They both have width=700

When I run build, I get two identical images generated of width 700.

Note that if I tweak them both to use GetImage, they deduplicate correctly, so worth noting this as a workaround.

See mastfissh/safety_matrix@50c3d24 which is a commit that implements this workaround

What's the expected result?

I would hope for the generated image result to be deduplicated - ideally the name would be related to the properties somehow, so the image could be cached in between pages.

Link to Minimal Reproducible Example

mastfissh/safety_matrix@50c3d24

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)feat: assetsRelated to the Assets feature (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions