Registry / devops / webpack-license-plugin

webpack-license-plugin

JSON →
library4.5.1jsnpmunverified

A webpack plugin that extracts open source license information from npm packages in your webpack output. Current stable version is 4.5.1, released with regular updates. It supports webpack 2 through 5 and helps generate a bill of materials in JSON, HTML, CSV, or custom formats. Key differentiators include built-in license policy enforcement (fail on unacceptable licenses), exclusion of internal packages, and full test coverage. Since v4.4.1, the package ships both ESM and CJS builds with TypeScript types, and requires Node >=16.

npm install webpack-license-plugin
INSTALL
IMPORT
SIG · WEBPACK-LICENSE-PL
W
webpack-license-plugin
devopsjavascriptv4.5.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

LicensePlugin
✓ import LicensePlugin from 'webpack-license-plugin'
✗ const LicensePlugin = require('webpack-license-plugin')
ESM default import is preferred since v4.4.1. CJS require still works via the package's CJS build.
LicensePluginOptions
✓ import type { LicensePluginOptions } from 'webpack-license-plugin'
TypeScript users can import the options interface for type checking.
PluginOutput
✓ import type { PluginOutput } from 'webpack-license-plugin'
Type export for the output data type of the plugin.

Basic usage with options: output JSON, reject GPL-family licenses, exclude internal packages.

// webpack.config.js import LicensePlugin from 'webpack-license-plugin'; export default { plugins: [ new LicensePlugin({ outputFilename: 'thirdPartyNotice.json', unacceptableLicenseTest: (licenseIdentifier) => ['GPL', 'AGPL', 'LGPL', 'MPL'].includes(licenseIdentifier), excludedPackageTest: (packageName) => packageName.startsWith('@mycompany/'), }), ], };
Debug
Known issues
breakingRequires Node >=16 as of v4.5.0; earlier versions may work on Node 12 but are not supported.
fix
Upgrade Node to version 16 or later.
affects: >=4.5.0
gotchaThe plugin taps into webpack's compilation hooks; if using webpack 5's persistent caching, ensure the plugin is not excluded from caching (it uses tapAsync which is cacheable by default).
fix
If you encounter stale license output, clear the webpack cache or configure the plugin to run on every build.
affects: >=4.0.0
deprecatedThe option `licenseOverrides` was used in earlier versions but is not documented in v4; instead use `additionalFiles` or custom output.
fix
Migrate to the new options schema (see README).
affects: <4.0.0
gotchaWhen using output format other than JSON, the custom renderer function must be provided – otherwise the plugin outputs JSON by default.
fix
Set the `outputFormatter` option to a function that returns the desired format string.
affects: >=4.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'webpack-license-plugin'
The package is not installed or the import path is incorrect.
fix
Run `npm install -D webpack-license-plugin` or `yarn add -D webpack-license-plugin` and ensure your import uses the correct path.
TypeError: LicensePlugin is not a constructor
Using a named import instead of default import when importing from ESM.
fix
Use `import LicensePlugin from 'webpack-license-plugin'` (default import) instead of `import { LicensePlugin } from 'webpack-license-plugin'`.
Error: Cannot find module 'webpack'
Webpack is not installed or is a peer dependency missing.
fix
Install webpack: `npm install webpack` or `yarn add webpack`.
Upgrade
Version history
4.5.1latest on npm
Audit
Dependencies
webpackrequiredWebpack is a peer dependency required to run the plugin. Supports versions >=4.0.0 and <6.0.0.
Agent activity
13 hits · last 30 days
node
12
Resources
webpack-license-plugin — npm install webpack-license-plugin · libregistry