Next.Js 图像组件不会在本地主机上加载图像

时间:2021-05-15 06:35:15

标签: next.js nextjs-image

我已在 next.config.js 上设置了图像域,但图像未显示在 localhost 上。然而,当代码被推送到生产环境时,图像会加载到 vercel 上。

在本地主机上,我得到以下图片。图片无法加载。

enter image description here

在生产中,可以看到图像

enter image description here

我应该怎么做才能看到开发中的图像?

module.exports = {
    images: {
        domains: [ 'd31wtm2rx76rut.cloudfront.net'],
    },
}
<NextImage
    src=https://d31wtm2rx76rut.cloudfront.net/1604303981874
    alt="Khanna"
    layout="fill" />

0 个答案:

没有答案