Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: @astrojs/image should use root relative paths in the _image?href= endpoint #3997

Closed
1 task done
tony-sull opened this issue Jul 20, 2022 · 2 comments
Closed
1 task done
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@tony-sull
Copy link
Contributor

What version of astro are you using?

1.0.0-beta.73

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

none

What package manager are you using?

pnpm

What operating system are you using?

mac

Describe the Bug

In astro dev, the image integration uses an image's full path in the _image?href= endpoint. This only happens in dev, but really should use a root relative path if possible

Link to Minimal Reproducible Example

https://astro.new

Participation

  • I am willing to submit a pull request for this issue.
@ivoba
Copy link

ivoba commented Aug 18, 2022

I noticed probably the same issue when trying the blog example with Hero image and the Picture component.

heroImage:
  src: "../img/blog/blindschleichen-sichtung.jpg"
  alt: "Blindschleiche und Ameisen"

import { Picture } from '@astrojs/image/components';
...
<Picture src={import(heroImage.src)} widths={[200, 400, 800]} sizes="(max-width: 800px) 100vw, 800px" formats={['avif', 'jpeg', 'png', 'webp']} alt={heroImage.alt} />

This works with npm run dev but fails with npm run build

error Cannot find module '/home/runner/work/biotop-sielsdorf/biotop-sielsdorf/img/blog/blindschleichen-sichtung.jpg' imported from /home/runner/work/biotop-sielsdorf/biotop-sielsdorf/dist/entry.mjs

@tony-sull
Copy link
Contributor Author

Looks like I lost this bug in the mix, @astrojs/image started using relative paths in the refactor around v0.8.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants