lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

Image component can't handle public images

Open FredKSchott opened this issue 3 years ago • 5 comments

What version of astro are you using?

1.0.6

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

none

What package manager are you using?

npm

What operating system are you using?

mac

Describe the Bug

Just FYI for this channel: I ran into a problem where I couldn't use <Image> with a hard-coded URL to public/ images. aka <Image src="/images/foo.png"> failed to load. This was trouble for MD/MDX where the YAML value of an image is always going to be a string and never an ESM import, so it kind of has to be inside of public/ and not src/. Basically, I ended up in a weird spot where I couldn't put the image in public/ OR src/.

I ended up fixing with this workaround I found in our new homepage repo: https://github.com/withastro/astro/pull/4283/files#diff-596f6d9d962689a44455508576c0510fd99acfe8ff60c87bd7b7108e472c5c29R21-R33

But that's way too much to ask every user to do, so I think we need to 1) add support for <Image src="/images/foo.png" /> to point to public/. And, 2) revisit our guidance on using @astrojs/image with MD/MDX

Link to Minimal Reproducible Example

https://github.com/withastro/astro/pull/4283/files#diff-596f6d9d962689a44455508576c0510fd99acfe8ff60c87bd7b7108e472c5c29R21-R33

Participation

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

FredKSchott avatar Aug 21 '22 17:08 FredKSchott