question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Svg files aren't displayed

See original GitHub issue

Describe the bug SVG images aren’t loading

To Reproduce

/*  CSS */
/* image is not displayed */
.png {
  background: url('./../assets/test.png') center center no-repeat;
}

/* image displayed */
.svg {
  background: url('./../assets/test.svg') center center no-repeat;
}

Expected behavior SVG file should be displayed

Desktop (please complete the following information):

Additional context I guess solution is to make some changes inside webpack.config.js, but I am not sure about this

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
artraydcommented, Jun 30, 2020

That worked, thank you for support and your awesome project!

Removed at |svg from this line: test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,

0reactions
Kocalcommented, Jun 30, 2020

Hum, that’s probably because there is two rules for .svg files: https://github.com/Kocal/vue-web-extension/blob/master/template/webpack.config.js#L47-L65 … but I’m not sure.

Can you try to remove |svg from the 2nd rule?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Images in SVG Image tags not showing up in Chrome, but ...
Viewing the SVG in your browser (ie. the .svg file) is fine, because you are not loading it via an <img> . The...
Read more >
SVG file not showing - Bugs - Forum | Webflow
They show properly for a couple of seconds and then disappear. The image element is still there, linked to the right file, but...
Read more >
SVG image not displaying properly in HTML webpage
Save as optimized SVG. In particular, in Illustrator, don't use "Save as", use File > Export > Export for Screens .... Then select...
Read more >
Serve SVG with the Correct Content Type - CSS-Tricks
If you are trying to use SVG like <img src="image.svg"> or as a CSS background-image , and the file is linked to correctly...
Read more >
How to Fix Problems with Displaying SVG Images within an ...
How to Fix Problems with Displaying SVG Images within an HTML Image Element · Change the image element to an embed element: <embed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found