0

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?

Leon Michalak
  • 413
  • 6
  • 14

1 Answers1

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.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Burak özenç
  • 13
  • 1
  • 3