我和Nextjs有一个很难解决的问题,我把它连接到一个cms (storyblok),我使用的所有图像都来自那个地方。所有的映像都能正常工作,但是现在我添加了一些新的映像,并且我不断地得到主机没有配置的错误,但是它是!
错误:
Error: Invalid src prop (https://a.storyblok.com/f/130657/88x88/f37f10e611/giantstitanslogo.png) on `next/image`, hostname "a.storyblok.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host组件,logoImg.filename是src url:
<Image
src={logoImg.filename}
alt={logoImg.alt}
width={logoImgDimensions.width}
height={logoImgDimensions.height}
layout="responsive"
/>以及配置:
module.exports = {
images: {
domains: ["a.storyblok.com"],
},
experimental: { esmExternals: true },
};此外,如果我做以下几点:
将图像组件注释掉,save
发布于 2021-10-27 18:04:42
我无意中在这里找到了答案:https://github.com/vercel/next.js/discussions/18311#discussioncomment-113194
无论出于什么原因,我的Image组件都是从"next/Image"而不是"next/image"映像导入的,其中包含了小的"i",一旦我将导入更改为"next/ image“,它就能正常工作。
https://stackoverflow.com/questions/69735652
复制相似问题