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-licenseVerified import paths — ran on the pinned version, not inferred.
Shows a minimal setup with banner from file and third-party license output.
Upgrade Node to >=14 and Rollup to ^1.0.0 or higher.
Use `thirdParty.dependencies` or `thirdParty.output`.
Set minifier option to preserve comments, e.g., terser({ format: { comments: 'all' } }).Use `data` function to pass custom escaping or avoid template tags in banner.
If passing a string, use `banner: 'your string'` or `banner: { content: 'your string' }`.npm install rollup-plugin-license --save-dev; in .cjs, use dynamic import: const license = await import('rollup-plugin-license').then(m => m.default)Use default import: import license from 'rollup-plugin-license'
Use absolute path: path.resolve(__dirname, 'LICENSE')
Escape template tags: use `<%%` for literal `<%` or remove template syntax.