-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVGR generates invalid react component #11753
Comments
I got same issue. I used xmlnsXlink to replace xmlns:xlink, which works on some svg files. |
@damozhang I've tried using that but seems like that SVG file in particular still contains namespaces that trigger that error even after using that website to minify. And in general I shouldn't have todo that in first place. I feel like there is some configuration wrong/missing. |
same here, I import a svg and use it as a source to img, started getting this error after trying to upgrade to cra 5. |
Exactly same issue here |
Same here. |
Same |
Same here |
I imagine this probably ultimately caused by the problem with regular import described in #11770 rather than SVGR specifically. |
I find a similar issue on stackoverflow |
same here, I would rather see a different fix than modifying all the svg-s after they get updated again ang again. |
Has anyone found a fix/workaround for this issue yet? |
it would be good to have some feedback from the team, it's been more than 3 months and no idea if there is some working on it, it still has the "needs triage" tag. |
@fkrauthan and everyone else here, i too got this error but then found my SVG file was corrupted after setting up eslint, found there was one semicolon that got added in SVG file content. After removing it, the error got resolved. |
My file is definitely not corrupted as it works fine in inkscape and online tools. Plus the older version can without any issues display it. |
Hi everybody. I have same problem . after search and debug i use this method and my problem solved : |
This worked for me thankyou for providing neccessary resource links. |
use xmlnsSvg instead of xmlns:svg in the svg file. |
Converting your jpg or png file to SVG would solve this problem. |
thanks. this helped me |
Yeah but kinda defeats the purpose of using SVG in first place. I also don't think its some illegal character as SVG programs can show it. And re-exporting through Inkscape yielded the same result. |
Same with me here, I upgraded react scripts from 4.0.3 to 5.0.0 and am getting the same error. Please let me know if any workarounds |
still no solution? |
My working solution: |
Thanks. This worked for me. |
Describe the bug
I've just upgraded to react-scripts
5.0
but my simple import of a Logo svg fails with the error:I wasn't even planning to use the module and instead just use an
img
tag with the SVG as source (similar to what the sample application does).Did you try recovering your dependencies?
This does not seem to be a dependency issue.
Which terms did you search for in User Guide?
I've tried to search for SVG, files as well as creating a new getting started to compare the projects. The only thing I can see is that the sample SVG is a lot simpler then the Logo I am trying to use.
Environment
Steps to reproduce
yarn run start
ornpm run start
Expected behavior
Ether a way that I can disable the component generation (in case I don't need it) or a valid component that actually compiles with the react-scripts provided build setup/
Actual behavior
Code is not compiling as soon as I import the SVG with the error:
Reproducible demo
The setup to reproduce is pretty simple. See above for instructions. But here is a project as well test_app.zip
The text was updated successfully, but these errors were encountered: