A minimal Vue library starter, built on top of Vite & Vue 3
TOC
- Package manager pnpm, safe and fast
- Bundle with the library mode
- Release with semantic-release
- Publish to npm
create a repo from this template on GitHub
git clone https://github.com/xiaoluoboding/vue-library-starter
cd vue-library-starterBuilding it is as easy as 1, 2, 3.
pnpm installRename all the vue-library-starter to your component name in the file package.json、vite.config.ts, eg: my-component
pnpm run build:libThis repository ships a Nuxt module so you can use the library in Nuxt projects.
- Prepare the Nuxt playground and stub the module (handy for local testing)
pnpm run dev:nuxt:prepare- Run the Nuxt playground to verify everything works
pnpm run dev:nuxt- Build the Nuxt module artifacts to
lib/nuxt
pnpm run build:module- (Optional) Build all outputs (ESM, UMD, Nuxt) in one go
pnpm run releaseUse in a Nuxt app by adding the module and CSS in your nuxt.config.ts:
export default defineNuxtConfig({
modules: ['vue-library-starter/nuxt'],
css: ['vue-library-starter/style.css']
})npm publishMIT @xiaoluoboding