Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!