N
Nuxt6mo ago
wugge

SVG Loading different in Dev and Production

Hi! I'm using vite-svg-loader as a nuxt plugin to load my SVG's dynamically. Like this:
import desk from '@/assets/icons/desk.svg?url'
import desk from '@/assets/icons/desk.svg?url'
When this code runs with
npm run dev
npm run dev
everything is fine, after
npm run build
npm run build
however instead of getting the URL to the SVG I'm getting the SVG code itself returned, but I would need the URL like in dev mode. Could the SSR be causing this? Anybody has an idea or an advice how to implement this?
6 Replies
wugge
wuggeOP6mo ago
for additional info: the problem appeared after upgrading nuxt (and my other dependencies)
jonas
jonas5mo ago
I have the same problem. In dev it resolves to a url and in production to a data url (data:image/svg+xml,…)
MolakDul
MolakDul5mo ago
I use them as components; it's much easier to manage. import desk from '@/assets/icons/desk.svg?component';
manniL
manniL5mo ago
or why not a spritemap? 🙂
Mans
Mans5mo ago
? have you solve?
jonas
jonas5mo ago
I did not, I just moved these particular assets to the public folder and moved on to other things
Want results from more Discord servers?
Add your server