jpkleemans / vite-svg-loader

Vite plugin to load SVG files as Vue components
MIT License
557 stars 59 forks source link

Public path not matched when build #25

Closed Arthurin915 closed 2 years ago

Arthurin915 commented 2 years ago

Hello, when I try to use a svg from public path it works in the dev server, but breaks in build. image

If I v-bind the image src in the template with the same path, it surprisingly works, even in build image

Any thoughts on why i get an error trying to build a simple svg? I'm not even trying to import as a component...

jpkleemans commented 2 years ago

Hi, thanks for reporting. Could you share an example project so I can reproduce the problem, and investigate how to resolve it.

Arthurin915 commented 2 years ago

Hi, i created this repo to reproduce the issue:

https://github.com/Arthurin915/vite-svg-loader-issue

I'm also confused why the svg loader would run an error if i'm not even importing it as a component, i'm importing directly in the src img attribute.

Thanks, if you have any doubts about the repo please contact me

jd-solanki commented 2 years ago

I am also facing the same with the new vite project: Screenshot 2021-10-27 at 11 37 04 PM

nxmad commented 2 years ago

Looks like @jpkleemans is not maintaining this lib. I can confirm this problem still exists. Loader should ignore file if path starts with a forward slash.

jpkleemans commented 2 years ago

@nxmad I definitely do maintain this library (just did a new release last week), however it is hard for me to find much time for it in my spare time. So, if you could help fix this issue by submitting a Pull Request for example, that would be very helpful!

nxmad commented 2 years ago

@jpkleemans That's great to hear, thanks for your work. I'm not into plugins development so much. May be not the best solution, but at least it works - https://github.com/jpkleemans/vite-svg-loader/pull/46

jpkleemans commented 2 years ago

Fixed in v3.3.0