An unplugin that generates declaration files (*.d.ts) from .ts(x) or .vue source files when using library mode.
It evolved from vite-plugin-dts, and after being rewritten with unplugin, it has become more versatile.
English | 中文
pnpm i -D unplugin-dtsPrevious only for Vite (not recommend):
pnpm i -D vite-plugin-dtsimport dts from 'unplugin-dts/vite'
export default defineConfig({
plugins: [dts()],
})Supports Vite, Rollup, Rolldown, Webpack, Rspack and Esbuild. See Usage for detailed bundler setup.
- Usage - Installation and bundler configuration
- Options - Full plugin options reference
- FAQ - Frequently asked questions and solutions
- Migration (v4 → v5) - Migrating from vite-plugin-dts v4
Thanks for all the contributions!
Clone and run the following script (see demo series scripts in root package.json):
pnpm run demo:ts-rollup
pnpm run demo:react-vite
pnpm run demo:vue-rspackThen check examples/*/types.
There are also many cases under examples.
A real project using this plugin: Vexip UI.
MIT License.