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.

Inline SVGs not rendering and break page

See original GitHub issue

🐛 Bug Report

This may be user error, as I feel like this is core enough that it would have already been reported, so I apologize if I waste anyone’s time.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. npx @docusaurus/init@next init my-website classic
  2. Add the following to the top of mdx.md:
import Mountain from '@site/static/img/undraw_docusaurus_mountain.svg';

A mountain:
<Mountain />
  1. Go to http://localhost:3000/docs/mdx The page should be broken and the following error should be in the developer panel: DOMException: Failed to execute 'createElement' on 'Document': The tag name provided ('/assetsundraw_docusaurus_mountain-b480421ae597bc5783ec62d605645b24.svg') is not a valid name.

I want to add that I also tried including the svg in an external component file with the same results

Your Environment

This was done with the most recent version of docusaurus

Reproducible Demo

I’m not including a link because the steps to reproduce from scratch are so quick. Hopefully that’s ok!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
slorbercommented, Jul 31, 2020

Hmmmm, I didn’t know we had that!

Need to check this next week, but I can confirm I see this webpack loader:

        {
          test: /\.svg$/,
          use: '@svgr/webpack?-prettier-svgo,+titleProp,+ref![path]',
        },
1reaction
oriooctopuscommented, Aug 5, 2020

Thank you @slorber !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chrome not rendering SVG referenced via <img> element
This happens when refreshing the page and initial page load. I can get the image to show up by "Inspecting Element" then right...
Read more >
SVGs not displaying in Chrome (Example) - Treehouse
The file paths are correct, but the SVGs are only displaying broken image icons, and the SVG used for a background image is...
Read more >
5 Gotchas You're Gonna Face Getting Inline SVG Into ...
This is a solvable. When you put inline svg within a ng-repeat to show a list of icons, the icons don't render on...
Read more >
Solving SVG Animation Issues - Iconify Documentation
Unfortunately, using animations is not that simple. First of all, there are two ways to render SVGs: ... When using inline <svg>, animations...
Read more >
Creating Accessible SVGs - Deque Systems
SVG animations must not auto-play for more than five seconds. ... render lighter and faster pages overall (versus inline SVGs) and allow for ......
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