Browser refusing to import SVG *raw* #2459
-
I've been pulling my hair out for HOURS over this. I've tried every known plugin related to rollup, vite, and svg. I even tried to roll my own plugin. Nothing works. I'm using vite 2.0.5 and vue 3.0.7. I need to import the source code of a bunch of SVG files as strings, not as Components. From the docs, this should work, but doesn't:
Instead, I get this browser error:
Since
Does anyone have ideas? I'm down to the wire on on a deadline, and without getting SVG icons working, I'm SOL. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I created a new repo and everything worked. |
Beta Was this translation helpful? Give feedback.
I created a new repo and everything worked.
Then I renamed the file where I was loading the SVG from
.js
to.ts
and... mine worked.I still have no idea what's going on.
Only the
import Foo from "foo.svg?raw"
syntax works.import()
doesn't return a string.