image icon indicating copy to clipboard operation
image copied to clipboard

Dropped srcset candidate "<URL>"

Open w3bsite opened this issue 2 years ago • 1 comments

I get this error only when I use this module.

Failed parsing 'srcset' attribute value since it has an unknown descriptor.

Capture

w3bsite avatar Nov 29 '23 16:11 w3bsite

Hi,

I have been having the same problem recently. It turns out it was because I didn't specify default image size in pixels but rather in view-width. Once I put some appropriate default size in pixels the message disappeared. Something like this:

<!-- Value for sizes was "90vw lg:200px xl:500px" -->
<NuxtImg
            format="webp"
            :src="`/media/plays/${mainAccent.slug}/photos/7.jpg`"
            :alt="`${mainAccent.name} - Poster`"
            class="img-fluid w-100 border border-3"
            sizes="250px lg:200px xl:500px"
            :placeholder="[5]"
            loading="lazy"
          />

I am not sure if that's an error on my side or if NuxtImage is intended to work like this. Hope this helps someone.

grandant avatar Jun 26 '24 13:06 grandant

Closing as the solutions was given.

Feel free to reopen if needed :)

Baroshem avatar Nov 28 '24 14:11 Baroshem