Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('/static/media/index.c6592bb6.ts') is not a valid name

I have a react app that I am trying to convert to use typescript

but I'm getting the following error: InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('/static/media/index.c6592bb6.ts') is not a valid name.

What does this error even mean? It looks like it doesn't like the typescript extension

Any ideas how to fix?

like image 998
Red Baron Avatar asked Jan 02 '19 09:01

Red Baron


2 Answers

In my case, I was building my web app and I had created a javaScript file in the IDE IntelliJ. But in the folder, the file name was missing the suffix ".js". So when I used 'npm run dev' command in the terminal, it failed to find the file I had created.

If it is the same for you, then just go to the folder and add the suffix ".js" in the file name.

I think it's a bug in IntelliJ, Hopefully they may fix it later on.

like image 196
Ming Avatar answered Sep 22 '22 18:09

Ming


In my case, it was just importing asset like this

import { ReactComponent as PaintIcon } from "./assets/paint.svg";

instead of

import PaintIcon from "./assets/paint.svg";

Thanks.

like image 29
Piyush Avatar answered Sep 24 '22 18:09

Piyush