With Expo web: Failed to execute 'createElement' on 'Document'
See original GitHub issueHello,
I am using Expo 39’s managed workflow.
I followed the installation instruction, created the metro.config.js
file, and copy-pasted the content from the instructions. I also added the packagerOpts
field to my app.json.
For testing purpose, I renamed my SVG file to logo.svg and used the following code in my app:
import Logo from "../../assets/images/avatars/logo.svg"
function TestComp() {
const size = 120;
return <Logo width={size} height={size}/>
}
Unfortunately, I am now getting the error:
InvalidCharacterError: Failed to execute 'createElement' on 'Document': The tag name provided ('/static/media/logo.6a5b59b1.svg') is not a valid name.
Any idea about what is causing the error?
I don’t know if it is related, but I do have a babel.config.js file in my root folder.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Failed to execute 'createElement' on 'Document': The tag ...
I got this error. It happened that the name of the js folder had spaces at the end of it.
Read more >@flyskywhy/react-native-gcanvas - npm
A C++ native canvas 2D/WebGL component based on gpu opengl glsl shader GCanvas. Latest version: 5.0.2, last published: 2 hours ago.
Read more >Failed to execute 'createElement' on 'Document' error message
Hello, while logged into my website, hovering over the “G Site Kit” link in the black WordPress admin bar at the top of...
Read more >Handle platform differences - Expo Documentation
Android, iOS, and the web have different capabilities. ... Stop the development server and run the following command to install the library: Terminal....
Read more >How to add React Native Web to an existing ... - Aryan Goharzad
If you've initialized your project with Expo, it already comes with React Native for Web pre-configured. Otherwise, you can find instructions on ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
encountered the same issue,
i solve this by adding
babel-plugin-inline-react-svg
as dev dependenciesthen add this to your
babel.config.js
thanks to this guy https://github.com/boopathi/react-svg-loader/issues/197#issuecomment-377562447
I created a temporary solution focused on the problem related to Expo, if you want you can take a look:
https://github.com/lucassouza16/react-native-svg-transformer-fix-expo