-
Notifications
You must be signed in to change notification settings - Fork 27k
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
chore(docs): add docs for .svg
unoptimized behavior
#60735
Conversation
If you need to serve SVG images with the default Image Optimization API, you can set `dangerouslyAllowSVG` inside your `next.config.js`: | ||
Therefore, we recommended using the [`unoptimized`](#unoptimized) prop when the [`src`](#src) prop is known to be SVG. This happens automatically when `src` ends with `".svg"`. | ||
|
||
However, if you need to serve SVG images with the default Image Optimization API, you can set `dangerouslyAllowSVG` inside your `next.config.js`: |
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.
Should we also mention the dangerouslyAllowSVG
option in the images
next.config.js page? https://nextjs.org/docs/app/api-reference/next-config-js/images
It would be good to mention all the keys for the images
option on this page.
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.
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.
Feels like we just need stronger SVG guidance: shouldn't be used with next/image
?
That removes the config option entirely.
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.
There are use cases where you might want svg to be cached and served from the same domain if the svg images are external urls. Although you can probably use rewrites
for this.
I think the word "dangerous" in the property name is pretty good guidance already.
Regardless, that doesn't answer @delba's question/suggestion 😅
Co-authored-by: Delba de Oliveira <[email protected]>
Closes NEXT-2119