-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next/image
gives false warning for sizes: 100vw
#58586
Comments
We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate. Why was this issue marked with the
|
Please note that the warning is only printed when the image is rendered less than next.js/packages/next/src/client/image-component.tsx Lines 118 to 129 in abe8b1e
|
I see! In that case I believe the warning is misleading. The image is not missing the |
Good point! Fixing in PR #61949 |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/unruffled-haze-nnxhyk?file=%2Fapp%2Fpage.tsx%3A4%2C28
To Reproduce
npm run dev
)Next/Image
like this:Image with src "https://images.unsplash.com/photo-1682686581484-a220483e6291?q=80&w=2970&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" has "fill" but is missing "sizes" prop. Please add it to improve page performance.
Current vs. Expected behavior
Current behaviour
Next/Image
withsizes="100vw"
andfill! gives the following warning:
Image with src "https://placehold.co/600x400" has "fill" but is missing "sizes" prop. Please add it to improve page performance.`Epx
Having the attribute
sizes
marked as100vw
is a valid use-case for full-page images (such as backgrounds). According to developer.mozilla.org there is no other way how to express 100% of viewport for this attribute than100vw
.Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 Binaries: Node: 20.9.0 npm: 10.1.0 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 14.0.3 eslint-config-next: 14.0.3 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Image optimization (next/image, next/legacy/image)
Additional context
In a Next.js dicusssion there are some solutions proposed that remove the error, such as using values as
100%
orauto
. They remove the warning, but none of them is a valid usage ofsizes
attribute.NEXT-2441
The text was updated successfully, but these errors were encountered: