This library, `declaration-bundler-webpack4-plugin`, bundles individual TypeScript declaration files (`.d.ts`) generated during the Webpack build process into a single, combined declaration file. It achieves this by re-composing the declarations as if all classes and interfaces were defined as internal modules within a specified `moduleName`. This makes the plugin particularly relevant for niche scenarios where classes and interfaces are deliberately exposed to a global module space, allowing for runtime access patterns that mimic internal TypeScript modules, often mapping prefixed URIs (like `foaf:Image`) back to module paths (e.g., `my.modules.rdfs.Image`). The current version is 1.0.6-beta.2. Given its beta status, the last commit dating back to early 2020, and its explicit tie to Webpack 4 (which is no longer the current major version of Webpack), its release cadence is effectively stalled, indicating it is no longer actively maintained. Its key differentiator is this unique, somewhat opinionated, approach to declaration bundling for a very specific internal module emulation pattern, which the documentation explicitly states makes it unsuitable for standard internal or external module usage. It primarily functions as an extension of `ts-loader`, requiring `ts-loader` to generate the initial individual declaration files for each source file, which this plugin then processes into a single output.
npm install declaration-bundler-webpack4-pluginVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic Webpack 4 configuration using `ts-loader` to compile TypeScript and `DeclarationBundlerPlugin` to consolidate generated `.d.ts` files into a single, internal-module-like declaration file, `bundle.d.ts`.
Carefully evaluate if your module exposure strategy aligns with the plugin's 'internal module' emulation. For typical TypeScript projects, a different declaration bundling approach is likely needed.
If using Webpack 5 or later, this plugin is unsuitable. Seek an alternative declaration bundling solution compatible with your Webpack version.
Ensure `ts-loader` is correctly set up in your Webpack configuration and `declaration: true` is enabled in your `tsconfig.json` to produce the necessary `.d.ts` artifacts.
Consider migrating to actively maintained declaration bundling solutions or be prepared to fork and maintain this plugin yourself if its niche functionality is critical to your project and no alternatives exist.
Run `npm install declaration-bundler-webpack-plugin --save-dev` or `yarn add declaration-bundler-webpack-plugin --dev`.
Ensure you are using `const DeclarationBundlerPlugin = require('declaration-bundler-webpack-plugin');` as the plugin exports as a CommonJS module and is not designed for ES module `import` syntax.Verify that `ts-loader` is properly set up in your Webpack configuration and that `declaration: true` is enabled within your `tsconfig.json` file to produce the necessary `.d.ts` artifacts.