Skip to content

@astrojs/image: Don't include original image in output bundle #4961

Description

@jkjustjoshing

What version of astro are you using?

1.2.5

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

No

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

I'm not sure if this is a bug or a feature request - my apologies if I should have submitted this to github.com/withastro/rfcs

When using @astrojs/image with the <Picture> component and widths={} prop, multiple different sizes of images end up in my ./dist/assets folder corresponding to the values I pass widths. However, there is also a copy of the original full-sized image.

This full-sized image is not referenced in the HTML at all, and is never downloaded by the site user, so I have no concerns for user-experience with an oversized image. However, including this full-size image in the bundle makes deploys slower and can increase hosting costs.

Suggested change

Remove full-size image from output directory

Alternatative

Setting in integration config options for removing the full-size image.

Link to Minimal Reproducible Example

Not applicable (but I can provide one if anyone disagrees)

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: nice to haveNot breaking anything but nice to have (priority)pkg: imageRelated to the `@astrojs/image` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions