create-vue icon indicating copy to clipboard operation
create-vue copied to clipboard

Scaffolding for a vue plugin on npm

Open luckydonald opened this issue 1 year ago • 3 comments

Please describe

Currently it's unclear how to setup and configure a repo to write a plugin for vue, i.e. a custom component to import from npm

Additional context

It would be great to have a generator for that, i.e. with

npm create vue@latest --plugin

or similar.

luckydonald avatar Sep 06 '24 12:09 luckydonald

I've seen https://vuejs.org/guide/reusability/plugins.html, but this is not covering how to have that plugin prepared to be a standalone (external) file (package.json, etc.), only the vue file(s) itself.

luckydonald avatar Sep 06 '24 12:09 luckydonald

@luckydonald You need Vite to create a bundle, here is a link https://vitejs.dev/guide/build.html#library-mode

Yordan-Ramchev avatar Sep 06 '24 13:09 Yordan-Ramchev

I've made a tool similar to create-vue, but aimed at scaffolding Vue-based libraries:

pnpm create @skirtle/vue-lib

It's likely there are still some important things I've missed, but it should be a lot better than starting from nothing.

I understand that an unofficial tool can't fully satisfy the same needs as an official solution, but if it proves popular then maybe it can act as a starting point for something official further down the line.

skirtles-code avatar Mar 15 '25 23:03 skirtles-code