docs: add example for enabling both AVIF and WebP image formats for better image optimization #86191
+23
−0
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)