Registry / devops / bundle-declarations-webpack-plugin

bundle-declarations-webpack-plugin

JSON →
library6.0.0jsnpmunverified

Webpack plugin that bundles TypeScript declaration files (.d.ts) into a single output file using dts-bundle-generator. Version 6.0.0 supports Webpack 5+, Node >=16, and is ESM-only since v6 (dropped CJS support). It wraps dts-bundle-generator (v9.3.1) with Webpack integration, allowing per-entry configuration, inline libraries, sorting, and banner control. Unlike similar plugins, it focuses on minimal configuration, supports multiple entry points and bundles, and exposes full dts-bundle-generator options. Release cadence is irregular, driven by dependency updates.

npm install bundle-declarations-webpack-plugin
INSTALL
IMPORT
SIG · BUNDLE-DECLARATION
B
bundle-declarations-webpack-plugin
devopsjavascriptv6.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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

BundleDeclarationsWebpackPlugin
import BundleDeclarationsWebpackPlugin from 'bundle-declarations-webpack-plugin'
const BundleDeclarationsWebpackPlugin = require('bundle-declarations-webpack-plugin')
Default ESM export only; CJS require fails in v6 (removed CommonJS bundle). Use import or update to CJS-compatible version (<6).
BundleDeclarationsWebpackPlugin
new BundleDeclarationsWebpackPlugin(options?)
new BundleDeclarationsWebpackPlugin.default(options)
Class constructor, not a function with .default. Direct instantiation.
BundleDeclarationsWebpackPlugin
import type { Configuration } from 'webpack'
import BundleDeclarationsWebpackPlugin from 'bundle-declarations-webpack-plugin'; import Configuration from 'webpack'
Configuration type is from webpack, not from this plugin. Use type import for TypeScript.

Minimal Webpack configuration to bundle TypeScript declarations using the plugin with default options; outputs index.d.ts alongside index.js.

import BundleDeclarationsWebpackPlugin from 'bundle-declarations-webpack-plugin'; import { resolve } from 'path'; import type { Configuration } from 'webpack'; export default <Configuration>{ entry: './src/main.ts', output: { filename: 'index.js', path: resolve('./dist'), }, plugins: [ new BundleDeclarationsWebpackPlugin({ outFile: 'index.d.ts', }), ], };
Debug
Known issues
breakingv6 removed CommonJS bundle output; require() will fail.
fix
Use import syntax or downgrade to v5.1.1 if CJS is required.
affects: >=6.0.0
deprecatedoptions.entry may be a string array (simple entry points) in older versions; v6 still supports but prefer object for consistent behavior.
fix
Use object format: new BundleDeclarationsWebpackPlugin({ entry: { filePath: './src/index.ts' } }).
affects: >=5.0.0
gotchaPlugin does not emit any declarations if entry file has no exports; results in empty .d.ts file.
fix
Ensure entry files have at least one export statement.
affects: >=3.1.0
gotchaWhen using multiple entry points, ordering of combined declarations may be unpredictable; use sortNodes option for stable output.
fix
Set { entry: { output: { sortNodes: true } } }.
affects: >=4.0.0
breakingv5 upgraded dts-bundle-generator from v8 to v9; some dts-bundle-generator options changed.
fix
Review dts-bundle-generator v9 migration guide; options like 'preferredConfigPath' may have changed.
affects: >=5.0.0 <6.0.0
securityPlugin depends on dts-bundle-generator which uses libraries that may have vulnerabilities; audit transitive dependencies.
fix
Run 'npm audit' regularly; consider overriding vulnerable transitive deps if needed.
affects: >=4.0.0
gotchaWindows path handling may produce empty output file if paths contain backslashes; fixed in v5.1.1.
fix
Upgrade to v5.1.1 or later; use forward slashes in configuration paths.
affects: <5.1.1
Errors
Common errors & fixes
Cannot find module 'bundle-declarations-webpack-plugin'. Did you mean to import "bundle-declarations-webpack-plugin"?
Using require() in v6 which dropped CJS support.
fix
Change to import statement or downgrade to v5.1.1.
TypeError: BundleDeclarationsWebpackPlugin is not a constructor
Using default import incorrectly or missing default export.
fix
Use: import BundleDeclarationsWebpackPlugin from 'bundle-declarations-webpack-plugin'
Error: Plugin could not find any TypeScript files in entry
Entry path is incorrect or file has no .ts/.tsx extension.
fix
Verify entry path and file extension; entry must point to a TypeScript file.
Module not found: Error: Can't resolve 'dts-bundle-generator'
Missing peer dependency; dts-bundle-generator not installed.
fix
Run: npm install dts-bundle-generator --save-dev
The class "BundleDeclarationsWebpackPlugin" has no public member "apply".
Instantiated incorrectly or not a Webpack plugin.
fix
Ensure new BundleDeclarationsWebpackPlugin() is added to the plugins array in Webpack config.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
dts-bundle-generatorrequiredCore library for bundling .d.ts files; version must be compatible with plugin.
webpackrequiredPeer dependency; plugin requires Webpack 5.
Agent activity
2 hits · last 30 days
node
2
Resources
bundle-declarations-webpack-plugin — npm install bundle-declarations-webpack-plugin · libregistry