Vite Library Mode Configuration
build.lib in vite.config.ts, entry point, formats (es/cjs/umd), external dependencies.
Library Mode
Vite's library mode builds a package meant to be imported by other apps rather than run as a website. You configure it under build.lib in vite.config.ts.
The entry Point
The entry file is the public surface of your library - it re-exports every component and utility consumers should access.
// src/index.ts
export { default as MyButton } from "./MyButton.vue";
export { default as MyCard } from "./MyCard.vue";All lessons in this course
- Vite Library Mode Configuration
- TypeScript Declarations for Component Libraries
- Tree-Shaking and Auto-Import
- Publishing to npm and Semantic Versioning