VS Code: SVG not previewed while opening with "Live Server"

Viewed 702

So I was working on my portfolio site and there was an image with svg extension. Whenever I open the page from VS Code "Open with Live Server" the image is not previewed. But if I open the same page from any browser (without VS Code Live Server) the image is previewed.

Why is this happening?

P.S: Other image formats work fine

2 Answers

Check your adblockers. I noticed errors in Chrome Dev Tools and it stated that three (same number of .svg images I was trying to load) images were blocked by my browser.

Disabling my adblocker allowed me to load my images using LiveServer.

I was specifically using "Adblocker for Chrome - NoAdds".

Try to install "SVG" extension in your VS Code. It helps with previewing svg images so it might work for "VS Code Live server" as well.

As far as I know, VS Code is treating .svg images differently than other formats.

Related