A Rollup plugin for bundling .d.ts TypeScript definition files into a single file. Current stable version is 6.4.1, released under maintenance mode with occasional compatibility updates for new TypeScript releases. Key differentiators: leverages TypeScript's own compiler for import resolution, automatically externalizes node_modules and @types, supports sourcemaps for Go-to-Definition via declarationMap. Alternatives include API Extractor and dts-bundle-generator. Requires Node >=20, peer dependencies rollup ^3.29.4 || ^4 and TypeScript ^4.5 || ^5.0 || ^6.0.
npm install rollup-plugin-dtsVerified import paths — ran on the pinned version, not inferred.
Basic Rollup configuration to bundle .d.ts files using the dts plugin. Input is .ts file, output is single .d.ts file.
Update Node to >=20, TypeScript to ^4.5+.
Upgrade Rollup to ^3.29.4 or ^4.
Use import { dts } from 'rollup-plugin-dts' instead.Use includeExternal option to bundle specific packages.
Do not use other Rollup plugins that modify module resolution.
Use import { dts } from 'rollup-plugin-dts' or use .mjs extension and named import.Ensure the module is installed or marked as external in tsconfig or plugin options.
Create a tsconfig.json with appropriate settings or use the tsconfig option.