Next.js Discord

Discord Forum

Disable image optimization and allow SVGs

Unanswered
Bell's Vireo posted this in #help-forum
Open in Discord
Avatar
Bell's VireoOP
Hello, for some reason unoptimized: true and dangerouslyAllowSVG: true don't work together - images should be optimized to allow svgs. O_o can i simply disable optimization?

14 Replies

Avatar
American Chinchilla
Svgs cant be optimized
Because their vectors
The only benefit from next image with svgs is the lazy loading
Avatar
Bell's VireoOP
@American Chinchilla I just don't know the mime type in advance - i want image optimization off - it eats my RAM
Avatar
American Chinchilla
But it shouldnt be consuming a lot of memory
Starting the dev server alone is already consuming some memory
Compared to next image
Avatar
Bell's VireoOP
@American Chinchilla
https://nextjs.org/docs/app/api-reference/components/image#src

When src is SVG format, it will be blocked unless unoptimized or dangerouslyAllowSVG is enabled


SVGs should work with unoptimized enabled, right?
Avatar
American Chinchilla
You can choose either or , im not sure about both
I never used either and it worked fine for me
But take with a grain of salt ^
Avatar
Bell's VireoOP
yeah it does not work
if you dont know the mime type in advance then you can use client side code to determine them at runtime