Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alloc/vite-dts
Blazing fast plugin that generates .d.ts modules for libraries
https://github.com/alloc/vite-dts
typescript vite vite-plugin
Last synced: about 8 hours ago
JSON representation
Blazing fast plugin that generates .d.ts modules for libraries
- Host: GitHub
- URL: https://github.com/alloc/vite-dts
- Owner: alloc
- License: mit
- Created: 2021-06-09T17:31:37.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-27T17:34:33.000Z (about 2 years ago)
- Last Synced: 2024-11-04T03:04:20.056Z (9 days ago)
- Topics: typescript, vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 16.6 KB
- Stars: 88
- Watchers: 3
- Forks: 15
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - vite-dts - Blazing fast plugin that generates .d.ts modules for libraries (TypeScript)
README
# vite-dts
[![npm](https://img.shields.io/npm/v/vite-dts.svg)](https://www.npmjs.com/package/vite-dts)
[![Code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/alecdotbiz)Generate a `.d.ts` module for both `.es` and `.cjs` entry points when using Vite's [lib mode](https://vitejs.dev/guide/build.html#library-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`](https://github.com/alloc/vite-dts/blob/master/demo/vite.config.js) file for more details.
```ts
import dts from 'vite-dts'export default {
plugins: [dts()],
}
```