wuruoyun / vue-component-lib-starter

A bare-bones example of creating your own Vue component library.
313 stars 59 forks source link

Exporting library with images #6

Closed llbarre closed 2 years ago

llbarre commented 4 years ago

First of all, thank you so much for putting this together. It's been a huge help.

I've got a case where the library I'm working with has a few svg icon sprite files that are access by props in a component:

<vu-icon icon="iconName" size="small></vu-icon>

I am able to correctly import the .svg files and the component renders perfectly in the docs. The problem is when I export the component (build), when accessing the .svg file, it assumes the 'js' folder, so the path for the .svg becomes:  http://localhost:8093/js/img/em-icons.43d70517.svg#map

Instead of:

http://localhost:8093/img/em-icons.43d70517.svg#map"

Note the js in the first path. The img folder and svg file names are correct. Any thoughts on how to make this work would be most appreciated.

Thanks in advance. 

wuruoyun commented 2 years ago

My apologies for the super late reply. The project has been updated to handle the static assets in the build, using font file as an example. It should work for images too.

ricardo17coelho commented 2 years ago

@wuruoyun what did u exaclty do to fix this issue?