Duplicate Dependencies Webpack Plugin

raw JSON →
1.0.2 verified Sat Apr 25 auth: no javascript

A webpack plugin to detect and report duplicated dependencies in the bundle. Version 1.0.2, stable, maintained sporadically. Key differentiator: provides a hook-based architecture for custom reporting, unlike simpler duplicates plugins that only warn. Allows programmatic access to duplicate package data (name, version, root path, bytes) for integration with custom reporters or CI checks. Primarily used in webpack 4 and 5 projects to audit dependency duplication.

error TypeError: DuplicateReporterPlugin is not a constructor
cause Incorrect import or usage of DuplicateReporterPlugin as default export without destructuring.
fix
Use const { DuplicateReporterPlugin } = require('duplicate-dependencies-webpack-plugin') or const Plugin = require('duplicate-dependencies-webpack-plugin'); new Plugin()
error Error: Cannot find module 'duplicate-dependencies-webpack-plugin'
cause Plugin not installed.
fix
Run npm install duplicate-dependencies-webpack-plugin --save-dev
gotcha Plugin adds overhead for large bundles; may slow down build.
fix Use only in development or CI, not production builds.
deprecated Webpack 4 hooks: compilation.hooks.additionalAssets may be deprecated in future webpack versions.
fix Test with webpack 5; plugin is compatible.
npm install duplicate-dependencies-webpack-plugin
yarn add duplicate-dependencies-webpack-plugin
pnpm add duplicate-dependencies-webpack-plugin

Minimal webpack config adding DuplicateReporterPlugin to detect duplicate dependencies in output.

const { DuplicateReporterPlugin } = require('duplicate-dependencies-webpack-plugin');

module.exports = {
  entry: './src/index.js',
  output: { filename: 'bundle.js' },
  plugins: [new DuplicateReporterPlugin()]
};