Registry / devops / rollup-plugin-license

rollup-plugin-license

JSON →
library3.7.1jsnpmunverified

Rollup plugin that adds a license banner to the final bundle and generates a file listing all third-party licenses. Current stable version is 3.7.1, released with support for Rollup 4.x peer dependency. Key differentiators: supports multiple banner comment styles (regular, ignored, slash, none), file or string content with Lodash template interpolation, third-party license output with version deduplication, and custom data injection. Widely used for compliance in open-source and enterprise bundles. Ships TypeScript definitions. Maintained actively with regular updates.

npm install rollup-plugin-license
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-LICE
R
rollup-plugin-license
devopsjavascriptv3.7.1
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

license (default)
import license from 'rollup-plugin-license'
const license = require('rollup-plugin-license')
This package is ESM-only; CommonJS require() will work in Node >=14 but the default export is a function. Use dynamic import() or ESM syntax in Rollup config.
license (type import)
import type { LicenseOptions } from 'rollup-plugin-license'
TypeScript types are bundled; use import type for options interface.
license (in CommonJS via .cjs)
const license = await import('rollup-plugin-license').then(m => m.default)
const license = require('rollup-plugin-license')
For .cjs config files, use dynamic import() to access the default export.

Shows a minimal setup with banner from file and third-party license output.

// rollup.config.js (ESM) import license from 'rollup-plugin-license' import path from 'node:path' export default { input: 'src/main.js', output: { file: 'dist/bundle.js', format: 'esm' }, plugins: [ license({ sourcemap: true, banner: { content: { file: path.resolve('LICENSE'), encoding: 'utf-8', }, }, thirdParty: { includePrivate: false, includeSelf: true, output: { file: path.resolve('dist/dependencies.txt'), }, }, }), ], }
Debug
Known issues
breakingVersion 3.x dropped support for Node <14 and Rollup <1.x. The plugin now requires Rollup ^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0.
fix
Upgrade Node to >=14 and Rollup to ^1.0.0 or higher.
affects: >=3.0.0
deprecatedThe option `dependencies` in banner template data is deprecated since version 3.0.0. Use `thirdParty` options instead.
fix
Use `thirdParty.dependencies` or `thirdParty.output`.
affects: >=3.0.0
gotchaUsing `commentStyle: 'ignored'` may not work in some minifiers (e.g., Terser) if they strip all comments by default. Ensure your minifier is configured to keep the banner.
fix
Set minifier option to preserve comments, e.g., terser({ format: { comments: 'all' } }).
affects: >=0.10.0
gotchaThe banner content is processed as a Lodash template with `dependencies` array. If the template contains `<%` or `%>`, these must be escaped or the plugin will throw a lodash error.
fix
Use `data` function to pass custom escaping or avoid template tags in banner.
affects: >=0.3.0
breakingVersion 0.10.0 changed `banner` from string to object with `content` and `commentStyle`. String usage still works but with deprecation warning.
fix
If passing a string, use `banner: 'your string'` or `banner: { content: 'your string' }`.
affects: >=0.10.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-license'
Package not installed or ESM-only module imported via require() in CommonJS context.
fix
npm install rollup-plugin-license --save-dev; in .cjs, use dynamic import: const license = await import('rollup-plugin-license').then(m => m.default)
TypeError: license is not a function
Importing the module incorrectly; likely using `require('rollup-plugin-license')` in ESM context.
fix
Use default import: import license from 'rollup-plugin-license'
Error: Banner file not found: 'LICENSE'
The path provided in `banner.content.file` is relative and may not resolve correctly.
fix
Use absolute path: path.resolve(__dirname, 'LICENSE')
Error: Template execution failed: ...
The banner contains invalid Lodash template syntax (e.g., unescaped `<%`).
fix
Escape template tags: use `<%%` for literal `<%` or remove template syntax.
Upgrade
Version history
3.7.1latest on npm
Audit
Dependencies
rolluprequiredPeer dependency; plugin integrates into Rollup build pipeline
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-license — npm install rollup-plugin-license · libregistry