https://github.com/keuby/vite-plugin-lib-types
Generate typescript declarations
https://github.com/keuby/vite-plugin-lib-types
Last synced: 5 days ago
JSON representation
Generate typescript declarations
- Host: GitHub
- URL: https://github.com/keuby/vite-plugin-lib-types
- Owner: keuby
- Created: 2022-11-25T09:11:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-18T18:09:54.000Z (4 months ago)
- Last Synced: 2025-03-22T21:37:34.006Z (28 days ago)
- Language: TypeScript
- Size: 271 KB
- Stars: 7
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-lib-types - Generate DTS file while building library. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-lib-types - Generate DTS file while building library. (Plugins / Framework-agnostic Plugins)
README
# vite-plugin-lib-types
Generate dts file while building library, supports vue file
## Usage
```bash
npm i -D vite-plugin-lib-types
```A simple example is shown below:
```ts
import { defineConfig } from 'vite';
import types from 'vite-plugin-lib-types';export default defineConfig({
plugins: [types()],
build: {
target: 'ES2018',
sourcemap: true,
minify: false,
lib: {
entry: 'src/index.ts',
formats: ['es', 'cjs'],
},
},
});
```## Options
| name | type | default | description |
| ------------ | -------------------- | ----------------------- | ------------------------------ |
| tsconfig | `object` | `undefined` | override the value of tsconfig |
| tsconfigPath | `string` | `${root}/tsconfig.json` | path of tsconfig |
| outDir | `string` | `undefined` | dts file output path |
| fileName | `string \| function` | `[]` | custom dts file names |
| transformers | `Transformer[]` | `[]` | Custom dts file transformer |