0Pricing
Vue Academy · Lesson

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

  1. Vite Library Mode Configuration
  2. TypeScript Declarations for Component Libraries
  3. Tree-Shaking and Auto-Import
  4. Publishing to npm and Semantic Versioning
← Back to Vue Academy