ascorbic / unpic-img

Multi-framework responsive image component
https://unpic.pics
1.38k stars 49 forks source link

Question: astro in development mode #714

Open artt opened 1 week ago

artt commented 1 week ago

Trying out unpic for Astro (5 beta), with the settings as in the doc:

image: {
  service: imageService(),
},

The build seem to run fine with different sizes generated.

However, in development mode, the src attribute is /_image?href=[__FILEPATH__]&w=[W]&h=[H] and Astro is complaining that the image could not be found.

What am I missing? Thanks!

artt commented 1 week ago

Upon closer inspection, seems like the src is missing another slash.

current: /_image?href=[__FILEPATH__]&w=[W]&h=[W]
fix:     /_image/?href=[__FILEPATH__]&w=[W]&h=[W]

This seems to be an issue only in Astro 5 beta when you specify trailingSlash: "always".

Related to this issue: https://github.com/withastro/astro/issues/11568

artt commented 1 week ago

Seems to be a problem with image endpoint's getting hardcoded. Opened an issue here: https://github.com/ascorbic/unpic/issues/141

Leaving this open since we might need a way to pass trailingSlash option down.