Registry / devops / license-webpack-plugin

license-webpack-plugin

JSON →
library4.0.2jsnpmunverified

A webpack plugin that extracts third-party library license information and outputs it to a file or adds a banner. Current stable version is 4.0.2. It supports webpack 4 and 5, outputs licenses per chunk or aggregated, and allows exclusion/inclusion patterns. Compared to alternatives, it offers comprehensive configuration for license compliance in webpack builds.

npm install license-webpack-plugin
INSTALL
IMPORT
SIG · LICENSE-WEBPACK-PL
L
license-webpack-plugin
devopsjavascriptv4.0.2
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.

LicenseWebpackPlugin
const { LicenseWebpackPlugin } = require('license-webpack-plugin');
const LicenseWebpackPlugin = require('license-webpack-plugin');
CommonJS require must destructure the named export 'LicenseWebpackPlugin'.
LicenseWebpackPlugin
import { LicenseWebpackPlugin } from 'license-webpack-plugin';
import LicenseWebpackPlugin from 'license-webpack-plugin';
ESM import must use named import. Default export does not exist.
PluginOptions
import { PluginOptions } from 'license-webpack-plugin';
TypeScript type import for configuration object (only needed when using TypeScript).

Creates a webpack plugin instance that writes a licenses.txt file, marks GPL and AGPL licenses as unacceptable, and customizes the license output format.

const { LicenseWebpackPlugin } = require('license-webpack-plugin'); module.exports = { plugins: [ new LicenseWebpackPlugin({ outputFilename: 'licenses.txt', unacceptableLicenseTest: (licenseType) => licenseType === 'GPL' || licenseType === 'AGPL', renderLicenses: (modules) => modules.map(m => `Package: ${m.name} - License: ${m.licenseId}`).join('\n'), }) ] };
Debug
Known issues
gotchaThe plugin does not automatically scan packages imported via SASS @import or other non-JS modules.
fix
Manually specify additional modules using the `additionalModules` option.
affects: all
gotchaRequires webpack 4 or 5; not compatible with webpack 3 or earlier.
fix
Upgrade webpack to version 4 or 5, or use an older version of the plugin (e.g., 2.x) for webpack 3.
affects: >=4.0.0
gotchaDefault output adds a banner to all JavaScript assets; may conflict with CSP (Content Security Policy).
fix
Set `addBanner: false` in plugin options to suppress banner injection.
affects: all
breakingVersion 4.x changed default export to named export 'LicenseWebpackPlugin'.
fix
Update import from default import to named import: `const { LicenseWebpackPlugin } = require('license-webpack-plugin')`
affects: >=4.0.0
Errors
Common errors & fixes
TypeError: LicenseWebpackPlugin is not a constructor
Using default import/require without destructuring (e.g., `const LicenseWebpackPlugin = require('license-webpack-plugin')`)
fix
Use `const { LicenseWebpackPlugin } = require('license-webpack-plugin')` or `import { LicenseWebpackPlugin } from 'license-webpack-plugin'`
Error: Cannot find module 'license-webpack-plugin'
The package is not installed or installed as devDependency incorrectly.
fix
Run `npm install --save-dev license-webpack-plugin`
No license information found for some modules
Certain packages do not include license information in their package.json.
fix
Use `licenseTypeOverrides` option to manually specify licenses for such packages.
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
webpackrequiredrequired as peer dependency to integrate with webpack build system
Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
license-webpack-plugin — npm install license-webpack-plugin · libregistry