srcset and sizes are not compatible #54371
Labels
bug
Issue was opened via the bug report template.
Output (export/standalone)
Related to the the output option in `next.config.js`.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Standalone mode (output: "standalone")
Describe the Bug
I want to generate an
srcset
based on exactly what I passed tosizes
. It's required because the sizes of my images are carefully tailored to match different screen dimensions, and their distortion or arbitrary sizing is unacceptable.Having set the 'sizes' attribute, I encountered the following issues:
srcset
do not match thesizes
valuessrcset
generated is larger than the actual file size.standalone
directory, I couldn't find images different from the main one. Should they be generated?srcSet
manually, but it's not allowed. Why?In additional, I am aware of the existence of
image.imageSizes
, but I cannot set it because my project has over 50 pages, each with a unique set of image sizes. I really don't understand the purpose of this option, as each image has unique proportions. This option should be generated for each image individually, rather than universally for all, and certainly not have predefined values exceeding the actual image sizes.Input:
Output:
Expected Behavior
Why does it matter?
1400px
800px
450px
If you pay attention, you'll notice that for a medium-sized screen (800px), a larger image is being used compared to a larger screen (1400px). And this is a common practice on many websites.
The text was updated successfully, but these errors were encountered: