Open valery-lavrik opened 1 year ago
Hey!
This plugin exports the EcmaScript module and stringifies using the '
apostrophe, as you can see here.
If there is an apostrophe in your SVG file, you must replace it with another symbol, i.e. the quotation mark "
.
Please let me know if this is the case for you! Good luck
I just checked and tweaked the settings a bit. Added @rollup/plugin-url plugin. Now here's what I get:
SVG file with which the problem:
<svg width="10" height="12" viewBox="0 0 10 12" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 0C5.55228 0 6 0.447715 6 1V8.58579L8.29289 6.29289C8.68342 5.90237 9.31658 5.90237 9.70711 6.29289C10.0976 6.68342 10.0976 7.31658 9.70711 7.70711L5.70711 11.7071C5.31658 12.0976 4.68342 12.0976 4.29289 11.7071L0.292893 7.70711C-0.0976311 7.31658 -0.0976311 6.68342 0.292893 6.29289C0.683417 5.90237 1.31658 5.90237 1.70711 6.29289L4 8.58579V1C4 0.447715 4.44772 0 5 0Z" fill="currentColor"/>
</svg>
I tried to debug the variable, and that's what I got in it:
ast: [
{
type: 'text',
content: 'export default "data:image/svg+xml,%3Csvg%20width%3D%2221%22%20height%3D%2221%22%20viewBox%3D%220%200%2021%2021%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M17.5%209.29199H3.5M17.5%209.29199C18.6046%209.29199%2019.5%2010.1874%2019.5%2011.292V17.292C19.5%2018.3966%2018.6046%2019.292%2017.5%2019.292H3.5C2.39543%2019.292%201.5%2018.3966%201.5%2017.292V11.292C1.5%2010.1874%202.39543%209.29199%203.5%209.29199M17.5%209.29199V7.29199C17.5%206.18742%2016.6046%205.29199%2015.5%205.29199M3.5%209.29199V7.29199C3.5%206.18742%204.39543%205.29199%205.5%205.29199M5.5%205.29199V3.29199C5.5%202.18742%206.39543%201.29199%207.5%201.29199H13.5C14.6046%201.29199%2015.5%202.18742%2015.5%203.29199V5.29199M5.5%205.29199H15.5%22%20stroke%3D%22currentColor%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%2F%3E%3C%2Fsvg%3E"'
}
I hope this will help in parsing the cause
I work in conjunction with tsdx
I'm trying to connect svg files directly with the code, but I get an error when assembling:
that's how I import a svg file:
What am I doing wrong?
My package.json file: