Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda