跳到內容
This is an unmaintained snapshot of the Astro v4 docs. View the latest docs.

Expected image options, not an ESM-imported image.

本頁內容尚未翻譯。

ExpectedNotESMImage: An ESM-imported image cannot be passed directly to getImage(). Instead, pass an object with the image in the src property.

An ESM-imported image cannot be passed directly to getImage(). Instead, pass an object with the image in the src property.

import { getImage } from "astro:assets";
import myImage from "../assets/my_image.png";
const optimizedImage = await getImage( myImage );
const optimizedImage = await getImage({ src: myImage });

See Also:

貢獻

你有哪些想法?

社群