Home

Awesome

vite-plugin-lib-types

Generate dts file while building library, supports vue file

Usage

npm i -D vite-plugin-lib-types

A simple example is shown below:

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

nametypedefaultdescription
tsconfigobjectundefinedoverride the value of tsconfig
tsconfigPathstring${root}/tsconfig.jsonpath of tsconfig
outDirstringundefineddts file output path
fileNamestring | function[]custom dts file names
transformersTransformer[][]Custom dts file transformer