Hi everyone!
I have a problem that I wanted to know if it’s a bug or not, but there is a problem!
When using the builder image
component, the image used on the front is always the source, not the webp file that builder generate.
On the dom, we have something like that (I replace the image url by “imageUrl” for better reading)
<picture>
<source
srcset="imageUrl?format=webp&width=100 100w,
imageUrl?format=webp&width=200 200w,
imageUrl?format=webp&width=400 400w,
imageUrl?format=webp&width=800 800w,
imageUrl?format=webp&width=1200 1200w,
imageUrl?format=webp&width=1600 1600w,
imageUrl?format=webp&width=2000 2000w,
**imageUrl**"
type="image/webp"
/>
<img
alt=""
role="presentation"
loading="lazy"
class="builder-image css-1hbf805"
src="imageUrl"
srcset="imageUrl?width=100 100w,
imageUrl?width=200 200w,
imageUrl?width=400 400w,
imageUrl?width=800 800w,
imageUrl?width=1200 1200w,
imageUrl?width=1600 1600w,
imageUrl?width=2000 2000w,
imageUrl"
sizes="(max-width: 767px) 100vw, 100vw"
/>
</picture>
The thing is, I don’t know why we have, in the source
tag, a fallback with the default url image (the line I put between *, juste after width=2000 2000w,
). If I remove this line, the picture display in webp format.
I don’t know if we do something wrong, but we use builder’s image component, so I don’t know why webp format are not used.
I’ve made a codepen to illustrate my words, in which I put the code with and without the line.
We can see we have both format loading in the page.
Builder content link
Prod link
Thank you for your help.
Etienne.