-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax warning for
next/image
loader width (#30562)
Some users reported false hits when using complex loaders that implement Art Direction. We can relax the warnings so that query string params named width should not warn.
- Loading branch information
Showing
3 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
test/integration/image-component/default/pages/invalid-loader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react' | ||
import Image from 'next/image' | ||
|
||
const Page = () => { | ||
return ( | ||
<div> | ||
<h1>Warn for this loader that doesnt use width</h1> | ||
<Image | ||
id="no-width" | ||
src="/test.png" | ||
width={100} | ||
height={100} | ||
loader={({ src }) => `${src}`} | ||
/> | ||
<Image | ||
id="width-path" | ||
src="/test.jpg" | ||
width={100} | ||
height={100} | ||
loader={({ src, width }) => `${src}/${width}/file.jpg`} | ||
/> | ||
<Image | ||
id="width-querystring" | ||
src="/test.webp" | ||
width={100} | ||
height={100} | ||
loader={({ src, width }) => `${src}?w=${width / 2}`} | ||
/> | ||
<Image | ||
id="width-querystring-full" | ||
src="/test.gif" | ||
width={100} | ||
height={100} | ||
loader={({ src, width }) => `${src}?width=${width * 2}`} | ||
/> | ||
<footer>footer</footer> | ||
</div> | ||
) | ||
} | ||
|
||
export default Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters