Skip to content
/ vite-dts Public

Blazing fast plugin that generates .d.ts modules for libraries

License

Notifications You must be signed in to change notification settings

alloc/vite-dts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-dts

npm Code style: Prettier Donate

Generate a .d.ts module for both .es and .cjs entry points when using Vite's lib mode. Instead of generating type definitions from your TypeScript source code (and bundling them), it assumes you will publish your source code, which means it can re-export from your TypeScript entry module. This improves performance drastically.

 

FAQ

  • Do I have to publish my src folder for this to work?
    Yes. For libraries, you generally need to do that anyway, if you publish sourcemaps (which you should).

  • Will this bundle my types?
    No. It merely re-exports from your library's entry module.

 

Usage

See the ./demo/vite.config.js file for more details.

import dts from 'vite-dts'

export default {
  plugins: [dts()],
}