Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
Using svg as img src in gatsby fails in netlify build

So I have an assets folder in src. This contains an SVG of my logo.

I import it in a component using:

import Logo from '/src/assets/logo.svg';

This is 100% the right path, and running the local npm run develop server the SVG loads fine. Now, when I push changes to the repository, so netlify builds the site, I get an error:

4:02:22 PM: failed Building production JavaScript and CSS bundles - 25.063s
4:02:22 PM: error Generating JavaScript bundles failed
4:02:22 PM: Can't resolve '../assets/logo.svg' in '/opt/build/repo/src/components'
4:02:22 PM: If you're trying to use a package make sure that '../assets/logo.svg' is installed. If you're trying to use a local file make sure that the path is correct.

I'm not trying to use it as a component (IF POSSIBLE), just put an img src as the SVG. However, as you can see it fails in the building process. Can anyone help?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You haven't provide the code that fails. Do you use gatsby-image for it or just HTML img tag?

If it is HTML tag, you can try it with object tag. Here is an answer about what to use with SVG files on Stack Oveflow and a basic usage of object tag.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda