Replies: 1 comment
-
|
This is a known breaking change in Nextra 3+. The new version uses Next.js image optimization by default, which doesn't handle SVGs the same way. The fix is to treat SVGs as static assets instead of letting the bundler process them as images. You have a couple of options: Option 1: Move SVGs to Put the file at Option 2: Configure Next.js to not optimize SVGs In your import nextra from "nextra";
const withNextra = nextra({ /* your nextra config */ });
export default withNextra({
images: {
dangerouslyAllowSVG: true,
contentDispositionType: "attachment",
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
});Option 3: Use an <img src="/flowcharts/mr_pipeline.drawio.svg" alt="Merge Request Pipeline" />Option 1 is the cleanest migration path for a large number of SVGs -- just move them all into |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We are trying to upgrade our Nextra 2 docs to a newer version but we are facing a regression. Can anyone tell us how to align with the previously working behaviour for SVG images.
Previously an SVG was aliased as a static file simply by...
...becoming aliased to
https://hostname.com/site-path/_next/static/media/mr_pipeline.drawio.fa66b4e1.svgas expected.Since upgrading to Nextra 3 all builds fail with the following...
The image file has not changed and it IS a valid image file.
Beta Was this translation helpful? Give feedback.
All reactions