Registry / type-stubs / rollup-plugin-dts-bundle

rollup-plugin-dts-bundle

JSON →
library1.0.0jsnpmunverified

A Rollup plugin that bundles all generated .d.ts files into a single declaration file using dts-bundle under the hood. Version 1.0.0 is the latest stable release; the project appears to be maintained sporadically. It integrates seamlessly with Rollup's build hooks (default writeBundle) and provides options like file cleanup and verbosity. Compared to alternatives like rollup-plugin-dts or @rollup/plugin-dts, this plugin offers less configuration overhead but relies on the older dts-bundle library.

npm install rollup-plugin-dts-bundle
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-DTS-
R
rollup-plugin-dts-bundle
type-stubsjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import dtsBundle from 'rollup-plugin-dts-bundle'
const dtsBundle = require('rollup-plugin-dts-bundle')
The package exports a single default function; ESM import is preferred for Rollup configs.
Plugin
import type { Plugin } from 'rollup'
import { Plugin } from 'rollup-plugin-dts-bundle'
This package does not export any types; the Rollup Plugin type can be used for TypeScript support.
Options
interface DtsBundleOptions { bundle: {...}; deleteOnComplete?: string[]; verbose?: boolean; hook?: string; }
The options interface is not exported; users should define their own or use inline types.

Rollup config with typescript2 plugin and dts-bundle plugin to bundle .d.ts files into one.

// rollup.config.js import typescript from 'rollup-plugin-typescript2'; import dtsBundle from 'rollup-plugin-dts-bundle'; export default { input: 'src/index.ts', output: { file: 'dist/bundle.js', format: 'esm' }, plugins: [ typescript({ tsconfig: './tsconfig.json' }), dtsBundle({ bundle: { name: 'my-library', main: 'dist/index.d.ts', out: 'bundle.d.ts', removeSource: true }, deleteOnComplete: ['dist/**/*.d.ts', '!dist/bundle.d.ts'], verbose: true }) ] };
Debug
Known issues
gotchaThe plugin requires dts-bundle, which is an older library with its own quirks (e.g., does not handle re-exports well).
fix
Ensure your .d.ts files are generated correctly; use the removeSource option to avoid duplicate declarations.
affects: >=1.0.0
gotchaDefault hook is writeBundle, which runs after the bundle is written. If you use generateBundle, types may not be available yet.
fix
Set hook to 'buildEnd' or 'generateBundle' based on your Rollup version and workflow.
affects: >=1.0.0
deprecateddts-bundle is in maintenance mode and may not support modern TypeScript features like project references or strict mode.
fix
Consider using rollup-plugin-dts or @microsoft/api-extractor for more robust declaration bundling.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'dts-bundle'
Missing peer dependency dts-bundle which is not automatically installed
fix
Run 'npm install dts-bundle --save-dev' or 'yarn add dts-bundle -D'
TypeError: dtsBundle is not a function
Using require instead of import in an ES module context, or incorrect import syntax
fix
Use 'import dtsBundle from 'rollup-plugin-dts-bundle'' in your config
Error: The 'bundle' option is required
Missing or incorrectly named 'bundle' configuration object
fix
Provide a bundle object with at least 'name' and 'main' properties
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
dts-bundlerequiredCore dependency handling the actual .d.ts bundling logic
rolluprequiredRequired peer dependency for the plugin interface
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
3
Amazon
1
Resources
rollup-plugin-dts-bundle — npm install rollup-plugin-dts-bundle · libregistry