NuxtN
Nuxtβ€’2y ago
Eβ™­

Extracting component(s) into a library

Is there some kind of "template" I can use to create a component library?

Well, not so much a library - I want to extract a single component from my app and make it so that myself and others can quickly and easily import it into any other projects, as and when needed.

The thing I 'm unsure about is that there are various other files that the component depends on, such as some library/util files and a bunch of audio files and such.

I need to know how to package all this stuff up together.

I did find this thing but it doesn't mention how to include assets such as images, audio etc. -

https://cli.vuejs.org/guide/build-targets.html#library

I also ran across this while searching -

https://github.com/laynezh/vite-plugin-lib-assets

But I'm not really sure if this does what I need, and/or if there is some other/better way.

Thank you!
GitHub
A Vite Plugin extracts resource files referenced in library mode instead of embedded them as base64. - laynezh/vite-plugin-lib-assets
GitHub - laynezh/vite-plugin-lib-assets: A Vite Plugin extracts res...
Was this page helpful?