docs: add example for enabling both AVIF and WebP image formats for better image optimization#86191
Merged
icyJoseph merged 11 commits intovercel:canaryfrom Nov 20, 2025
Conversation
… WebP formats. Added configuration examples and clarified caching behavior for multiple formats.
Member
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
icyJoseph
reviewed
Nov 17, 2025
icyJoseph
reviewed
Nov 17, 2025
- Add note about cache overhead when using multiple formats - Remove redundant note about array order (already mentioned earlier) Addresses feedback about documenting increased storage requirements when enabling both AVIF and WebP formats, and removes duplicate information about format order.
…om/KaziMahbuburRahman/next.js into docs/add-avif-webp-formats-example
…om/KaziMahbuburRahman/next.js into docs/add-avif-webp-formats-example
icyJoseph
reviewed
Nov 19, 2025
added 2 commits
November 20, 2025 11:06
icyJoseph
approved these changes
Nov 20, 2025
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Title
docs: add example for enabling both AVIF and WebP image formats
Description
What?
This PR enhances the image component documentation by adding examples showing how to enable both AVIF and WebP image formats together in
next.config.js. It also updates theimage-componentexample to demonstrate this configuration.Why?
Currently, the documentation only shows examples for:
formats: ['image/webp']formats: ['image/avif']However, many developers want to enable both formats together to:
This configuration is a best practice but wasn't clearly documented with an example.
How?
formats: ['image/avif', 'image/webp']to App Router image component documentationexamples/image-component/next.config.jsto demonstrate the configurationChanges Made
docs/01-app/03-api-reference/02-components/image.mdx- Added AVIF + WebP exampledocs/02-pages/04-api-reference/01-components/image-legacy.mdx- Added AVIF + WebP exampleexamples/image-component/next.config.js- Added formats configurationTesting
Checklist
pnpm prettier-fixto fix formatting issues (if applicable)