PART 10
Library mode
build.lib in full, type declarations, a cross-framework component library.
- 10.1`build.lib` Configuration ReferenceVite library mode is not just a different entry. Learn build.lib, formats, external, exports, CSS output, peerDependencies, and consumer verification.
- 10.2Generating Type Declaration FilesPublishing an npm package requires .d.ts type declarations — vite-plugin-dts generates them automatically, when to hand-write .d.ts files, and how tsconfig settings affect the output.
- 10.3Project 8: Publishing a Cross-Framework Component LibraryUse Vite library mode to build a Button component that supports React, Vue, Svelte, and Solid simultaneously — one core logic package, four framework adapters, each published as an independent npm package.