我正在使用Next.js 10.0.7和next-images 1.7,大尺寸图片需要一些时间才能显示出来。
我已正确使用组件,如下所示,但我认为有解决我的问题的方法。
<Image
height="600"
width="800"
src={
'https://myImageURL.png'
}
alt="my image"
/>
一些问题:
- 如果我将所有图像转换为.webp格式,它们会更快地显示吗?
- 这个问题是否有解决方案?
- If I convert all images to .webp format, will they be displayed faster?
- Is there a solution to this problem?
sharp
添加到应用程序包中,还是在部署命令的一部分中运行了yarn add sharp
? - bishalyarn add sharp
将sharp
添加到我的项目包中,并且它大大加快了我的图像速度。 - James Hoopersharp
;这意味着你只需要安装sharp
即可。这是文档中托管部分的注释,简单地建议安装sharp
,而这里是当你在生产环境中不使用sharp
时的错误信息,以及如何安装的解决方案。祝好运! - James Hooper