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
fix: skip resizing image if it's animated #39325
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d23f79a
add `is-animated` types
balazsorban44 8a730f7
add test
balazsorban44 97dac8d
fix: skip resizing image if it's animated
balazsorban44 d456e3e
remove tests
balazsorban44 56c93f3
update tests
balazsorban44 f5e4249
Merge branch 'canary' into fix/issue-39317
balazsorban44 9056b80
Merge branch 'canary' into fix/issue-39317
kodiakhq[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
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 |
---|---|---|
@@ -1,13 +1,40 @@ | ||
import Image from 'next/image' | ||
import Logo from '../public/test.jpg' | ||
|
||
function Home() { | ||
import img1 from '../public/animated2.png' | ||
import img2 from '../public/äöüščří.png' | ||
import img3 from '../public/test.avif' | ||
import img4 from '../public/test.jpg' | ||
import img5 from '../public/test.webp' | ||
import img6 from '../public/animated.gif' | ||
import img7 from '../public/grayscale.png' | ||
import img8 from '../public/test.bmp' | ||
import img9 from '../public/test.png' | ||
import img11 from '../public/animated.png' | ||
import img12 from '../public/mountains.jpg' | ||
import img13 from '../public/test.gif' | ||
import img14 from '../public/test.svg' | ||
import img15 from '../public/animated.webp' | ||
import img17 from '../public/test.ico' | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<h1>Image Optimizer Home</h1> | ||
<Image src={Logo} /> | ||
<Image src={img1} /> | ||
<Image src={img2} /> | ||
<Image src={img3} /> | ||
<Image src={img4} /> | ||
<Image src={img5} /> | ||
<Image src={img6} /> | ||
<Image src={img7} /> | ||
<Image src={img8} /> | ||
<Image src={img9} /> | ||
<Image src={img11} /> | ||
<Image src={img12} /> | ||
<Image src={img13} /> | ||
<Image src={img14} /> | ||
<Image src={img15} /> | ||
<Image src={img17} /> | ||
</> | ||
) | ||
} | ||
|
||
export default Home |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: #39325 (review)
The issue was that we only imported a single image file on the page, so the
nextBuild
command did not fail early. I added all the valid image imports.This line should now cover the fix in this PR.
We might want to create a separate test suite to check if Next.js builds with valid/invalid images and gives a proper message if it's the latter.
E.g.: I noticed that importing
.tiff
does not work. The build throws an error that there is no appropriate webpack loader for this file. I thought of adding it here:next.js/packages/next/build/webpack-config.ts
Line 233 in d88fd14
But then I get this build error:
So I am actually not sure about the level of our TIFF support here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't support TIFF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the PR description with this info to mention it was only affecting statically imported images during
next build