Registry / devops / rollup-license-plugin

rollup-license-plugin

JSON →
library3.2.1jsnpmunverified

Extracts OSS license information from npm packages used in Rollup or Vite builds, generating a bill of materials (JSON, HTML, CSV, etc.). Current stable version is 3.2.1 (March 2026), distributed as ESM-only with TypeScript types. Key differentiators: supports both Rollup and Vite, enforces license policies (fails builds on unacceptable licenses), excludes internal packages, and offers customizable output formats.

npm install rollup-license-plugin
INSTALL
IMPORT
SIG · ROLLUP-LICENSE-PLU
R
rollup-license-plugin
devopsjavascriptv3.2.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.

createRollupLicensePlugin
import { createRollupLicensePlugin } from 'rollup-license-plugin'
const createRollupLicensePlugin = require('rollup-license-plugin')
ESM-only since v3. Use dynamic import() for CommonJS.
createViteLicensePlugin
import { createViteLicensePlugin } from 'rollup-license-plugin'
import { createViteLicensePlugin } from 'rollup-license-plugin' (none)
Same as createRollupLicensePlugin but for Vite.
PluginOptions
import type { PluginOptions } from 'rollup-license-plugin'
import { PluginOptions } from 'rollup-license-plugin' (value import)
TypeScript type import only; not a runtime value.
default
import rollupLicensePlugin from 'rollup-license-plugin'
const rollupLicensePlugin = require('rollup-license-plugin').default
Default export is an object { createRollupLicensePlugin, createViteLicensePlugin }. Avoid require() for default.

Configures rollup-license-plugin in a Rollup config to generate a third-party notice JSON and fail the build on GPL/AGPL licenses.

// rollup.config.js import { createRollupLicensePlugin } from 'rollup-license-plugin'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm' }, plugins: [ createRollupLicensePlugin({ outputFilename: 'thirdPartyNotices.json', // fail on GPL or AGPL licenses unacceptableLicenseTest: (licenseId) => /^(GPL|AGPL)/.test(licenseId), // exclude your own packages excludedPackageTest: (packageName) => packageName === '@mycompany/internal' }) ] };
Debug
Known issues
breakingv3 drops Node 16 support
fix
Upgrade to Node 18+
affects: >=3.0.0
breakingv3 is ESM-only, no CommonJS require()
fix
Use import() or convert project to ESM
affects: >=3.0.0
deprecatedv2.x supported Node 14, v3 removes it
fix
Use Node 18+
affects: >=3.0.0 <4.0.0
gotchaThe plugin must be placed after other plugins that may transform or remove imports
fix
Add the license plugin at the end of the plugins array
affects: >=2.0.0
gotchaOutput filename is relative to the build output directory
fix
Use path.relative or absolute path if needed
affects: >=3.0.0
gotchaLicense detection is based on node_modules metadata; works only for packages resolved by npm/yarn/pnpm
fix
Ensure all dependencies are actually installed
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'rollup-license-plugin' or its corresponding type declarations.
Package is ESM-only but project uses CommonJS require()
fix
Use dynamic import: const { createRollupLicensePlugin } = await import('rollup-license-plugin');
Error: 'createRollupLicensePlugin' is not a function
Incorrect import of default export (entire object)
fix
Use named import: import { createRollupLicensePlugin } from 'rollup-license-plugin';
The plugin outputFilename is not a string
Output path must be a string, not an object or array
fix
Pass a string like 'third-party-licenses.json'
Upgrade
Version history
3.2.1latest on npm
Audit
Dependencies
rollupoptionalpeer dependency for Rollup plugin integration
viteoptionalpeer dependency for Vite plugin integration
Agent activity
12 hits · last 30 days
node
10
Resources
rollup-license-plugin — npm install rollup-license-plugin · libregistry