tanem / react-svg

:art: A React component that injects SVG into the DOM.

Home Page:https://npm.im/react-svg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm run start displays normally, but some SVG does not display after npm run build. What is the reason

Acatworthloving opened this issue · comments

config:
image

Can display
<?xml version="1.0" encoding="utf-8"?> <svg t="1653445142208" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8408" width="200" height="200"><path d="M128 768h768v-85.333333H128v85.333333z m0-213.333333h768v-85.333334H128v85.333334z m0-298.666667v85.333333h768V256H128z" p-id="8409" ></path></svg>

npm run build Cannot be displayed
<?xml version="1.0" encoding="utf-8"?> <svg t="1655952122479" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4783" ><path d="M904.704 460.8H133.12a51.2 51.2 0 1 0 0 102.4h771.584a51.2 51.2 0 1 0 0-100.608zM397.568 191.744a51.2 51.2 0 0 0 35.584-14.848l35.584-35.584v204.8a51.2 51.2 0 1 0 100.608 0v-204.8l35.84 35.584a51.2 51.2 0 0 0 34.816 14.848 51.2 51.2 0 0 0 35.584-14.848 51.2 51.2 0 0 0 0-70.912l-68.864-69.12A124.672 124.672 0 0 0 531.968 1.792a53.248 53.248 0 0 0-12.8-1.792 49.152 49.152 0 0 0-12.288 1.792 123.904 123.904 0 0 0-76.8 35.072l-68.864 69.12a51.2 51.2 0 0 0 35.584 85.76zM604.672 847.36l-36.096 36.096v-204.8a51.2 51.2 0 0 0-100.608 0v204.8L432.64 847.36a51.2 51.2 0 0 0-71.168 0 51.2 51.2 0 0 0 0 70.912l69.12 69.12a121.344 121.344 0 0 0 76.8 35.328 44.8 44.8 0 0 0 10.24 0 123.392 123.392 0 0 0 88.064-36.608l69.12-68.864a51.2 51.2 0 0 0-71.168-71.168z" p-id="4784"></path></svg>

Hard to know what's going on here without a working bug reproduction showing the issue. One way to do that is to fork and modify the basic CodeSandbox example from the README: https://codesandbox.io/s/github/tanem/react-svg/tree/master/examples/basic-usage.

already solved

src url error

Ok, thanks for the update, closing 👍