Generate dts file while building library, supports vue file
npm install vite-plugin-lib-typesGenerate dts file while building library, supports vue file
``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'],
},
},
});
`
| name | type | default | description |
| ------------ | -------------------- | ----------------------- | ------------------------------ |
| tsconfig | object | undefined | override the value of tsconfig |string
| tsconfigPath | | ${root}/tsconfig.json | path of tsconfig |string
| outDir | | undefined | dts file output path |string \| function
| fileName | | [] | custom dts file names |Transformer[]
| transformers | | []` | Custom dts file transformer |