Next.js Discord

Discord Forum

Cached Image Files Got Larger

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
My webp images are ALL cached larger via next image - any idea why?

6 Replies

if you already got a webp image, why not just serve it directly via img
Image is intended for png/jpg as Image will simply convert them to webp at the desired width/height
if you supply it with a webp, the sharp running behind the scenes may do funny things with it making it slightly bigger
Transvaal lionOP
oh ok thank you :D
but then won't I lose stuff like avoiding layout shift?
@Transvaal lion but then won't I lose stuff like avoiding layout shift?
The layout shift only happens if the container is not equal to the size of the image. Thus the image shifts the layout on load.

So no you wont have layout shifts as long as you have a container the size of your image.