unpic-img icon indicating copy to clipboard operation
unpic-img copied to clipboard

[Astro] Images not found after build

Open techpoint24de opened this issue 6 months ago • 1 comments

Using unpic with Astro breaks after running build. In dev all images are loaded and the placeholders are working but after building the images are not served anymore.

Path after build: http://localhost:4321/_image?w=1920&h=1280&fit=cover&href=%2F_astro%2F8.B51ZUIHt.jpg

The images are in ./src/assets/images

Astro config

import { imageService } from "@unpic/astro/service";

[...]

image: {
    service: imageService(),
},

[...]

Image component (dynamically imported images using import.meta.glob())

import { Image } from "@unpic/astro";

[...]

const placeholder = blurhashToCssGradientString(blurHashes[index]);

[...]

<Image
    src={imageData.default.src}
    width={imageData.default.width}
    height={imageData.default.height}
    alt="Photo by XYZ"
    class="w-full h-auto object-cover rounded-xl"
    placeholder={placeholder}
/>

[...]

techpoint24de avatar Aug 11 '25 19:08 techpoint24de

Could you create a reproduction? Easiest is if you use https://astro.new/repro/

ascorbic avatar Aug 22 '25 14:08 ascorbic