Open BWagener opened 9 months ago
I'm running into the same issue. I have a bunch of images 128x128 pixels in size, I just want to generate WEBP and AVIF versions of them, but NuxtPicture
generates a whole entire slew of them at all sorts of different sizes... each generated image still being 128x128 regardless.
Because of that, the build process now takes so long it outright crashes sometimes.
Edit: The current workaround I found was explicitly setting the sizes of the picture:
<NuxtPicture
format="avif,webp"
sizes="128px"
densities="x1"
width="128"
height="128"
:src="img"
/>
I also added explicit x1
density because otherwise it would still generate the same 128x128 image for the x2
density anyway
I am running into a problem using NuxtPicture over NuxtImg.
NuxtImg - static generation of images works
When using NuxtImg and generating the images statically using
nuxt generate
works well:produces the following output
NuxtPicture - static generation of images is flawed
In contrast to this, using NuxtPicture and generating the images statically does not respect the desired width for the image and instead generates all possible size/format/fit combinations:
produces the following output
NuxtImg generates 2 images vs NuxtPicture's 18.
As the sizes outside the desired dimensions set on NuxtImg/NuxtPicture are irrelevant 16 irrelevant images were generated in this example.
This quickly gets out of hand with multiple images and inflates the size of the output.
Reproduction steps
To reproduce checkout https://github.com/BWagener/NuxtImage-bug-reproduction, edit the app.vue file, toggle the comment on either NuxtImg or NuxtPicture and run
nuxt generate
.