Image source set is incorrectly trimmed #41516
Labels
bug
Issue was opened via the bug report template.
Image (next/image)
Related to Next.js Image Optimization.
stale
The issue has not seen recent activity.
Verify canary release
Provide environment information
Codesandbox env:
My local env where the problem is the same as in Codesandbox:
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
My next.config.js for images is as the following:
The
sizes
property of next/image issizes="(min-width: 1010px) 250px, 100vw"
.Result: The source set includes only device sizes, so [800, 1600, 2000, 4000] since there is
100vw
.It's because the docs state:
However, in
sizes
there is also250px
and apparently, it's not taken into account. If it was, also 400 would be included in image srcset.Expected Behavior
Not only
vw
should be taken into account when trimming a source set but also other units. In this example, only 200 should be omitted but 400 should be included.Link to reproduction
https://codesandbox.io/s/gifted-wu-59ou5o?file=/pages/index.tsx
To Reproduce
Just inspect Elements in Devtools. In my case it looks:
The text was updated successfully, but these errors were encountered: