I am trying to build images referenced in a content collection using the image helper, and it works locally in dev mode, but it breaks when i try to build it. Any idea what's going on? I'm at loss what's going on here. Using the latest version of everything Astro 5.1.8.
So i have a collection that goes like this (omitting unimportant parts):
const demonsCategoriesCollection = defineCollection({
loader: file("./src/content/demons/categories.yaml"),
schema: ({ image }) => z.object({
name: z.string(),
iconSrc: image(),
})
});
The corresponding YAML has a bunch of entries (the @alias being set up properly in tsconfig.json):
- id: "something"
name: "Something"
iconSrc: "@content/demons/something/icon.webp"
I am trying to build those images in layouts and components. Here's a simplified Post.astro layout testing the problem:
---
import { Image, getImage } from "astro:assets";
import BaseLayout from "@layouts/demons/BaseLayout.astro";
import getCategory from "@utils/demons/getCategory";
const { props } = Astro.props;
let category = await getCategory(props.id); // returns a category entry
// Trying both with getimage
let testGetImage = await getImage({
src: category.data.iconSrc,
height: 128,
});
---
<BaseLayout {props}>
<Image src={category.data.iconSrc} alt="" width="128" />
<img src={testGetImage.src} alt="" />
<slot />
</BaseLayout>