vite-plugin-dts-bundle-generator
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

DTS Bundle Generator Vite plugin

npm npm npm

Ever wanted to easily package your typescript library with a bundled declaration file? Integrate DTS Bundle Generator within Vite!

Install

# npm
npm i vite-plugin-dts-bundle-generator

# yarn
yarn add vite-plugin-dts-bundle-generator

Usage

Add this block to your vite.config.ts:

import path from 'path';
import { defineConfig, normalizePath } from 'vite';
import dtsBundleGenerator from 'vite-plugin-dts-bundle-generator';

export default defineConfig({
  plugins: [
    dtsBundleGenerator({
      fileName: 'my-lib.d.ts',
      output: {
        // output options
      },
      libraries: {
        // libraries options
      }
    }, {
      // compilation options
    })
  ],
  build: {
    lib: {
      entry: normalizePath(path.resolve('src', 'index.ts')),
      formats: ['es'],
      fileName: 'my-lib.mjs'
    }
  }
});

And that's it!

Configuration

This library handle both single and multiple entrypoints. You can use any of the output, libraries and compilation options provided by DTS Bundle Generator.

Package Sidebar

Install

npm i vite-plugin-dts-bundle-generator

Weekly Downloads

35

Version

2.0.4

License

MIT

Unpacked Size

10 kB

Total Files

6

Last publish

Collaborators

  • f-lawe