【发布时间】:2021-08-12 06:32:11
【问题描述】:
我知道在不使用 TypeScript 的情况下使用 Next.js 图像组件时,需要在 next.config.js 中配置 URL,但我不确定为什么这不适用于 TypeScript。
....,未在您的
next.config.js中的图像下配置查看更多 信息:https://nextjs.org/docs/messages/next-image-unconfigured-host
解决方法是什么?还是我唯一的选择是使用常规的img 标签?
图像组件:
<Image
src="https://images.unsplash.com/photo-1621794279356-0150106a4b45?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1"
alt="blog title"
width="100"
height="100"
/>
next.config.ts
export const images = {
domains: [
"images.unsplash.com"
],
};
【问题讨论】:
标签: typescript next.js