Expected image options, not an ESM-imported image.
ExpectedNotESMImage: ESM 导入的图像无法直接传递给
getImage()
。相反,应传递一个带有图像的对象,并将图像放在src
属性中。
哪里出了问题?
段落标题 哪里出了问题?ESM 导入的图像无法直接传递给 getImage()
。相反,应传递一个带有图像的对象,并将图像放在 src
属性中。
import { getImage } from "astro:assets";import myImage from "../assets/my_image.png"; const optimizedImage = await getImage( myImage ); const optimizedImage = await getImage({ src: myImage });
请参阅:
Error Reference