Skip to content

Broken SVG Image Rendering with Nuxt Img in Client-Side Generated Builds #1806

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

Open
Bader-Idris opened this issue Apr 7, 2025 · 0 comments

Comments

@Bader-Idris
Copy link

I am experiencing an issue with the Nuxt Img component when using an SVG file in my Nuxt 3 application. The SVG image renders correctly in SSR mode, but when I build the application using the nuxt generate command for client-side rendering, the image appears broken.

Here is the relevant code snippet that causes the issue:

<NuxtImg
  src="/imgs/thanks.svg"
  alt="thank you message icon"
  :placeholder="[50, 50, 75, 75]"
  format="webp"
  loading="lazy"
/>

I have tried removing the :placeholder and format properties, but the issue persists. The path to the SVG file is located in the ~/imgs/ directory. Interestingly, other image formats, such as JPG, work perfectly with the same setup:

<NuxtImg
  src="/imgs/meTwentyFour.jpg"
  alt="example image"
/>

You can find the project repository, where the error occurs, at the following link: Nuxt 3 Fullstack Portfolio.

Could you please assist me in resolving this issue? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant