Registry / devops / rollup-plugin-banner

rollup-plugin-banner

JSON →
library0.2.1jsnpmunverified

Rollup plugin that appends content before the JS bundle file, preserving the banner even after minification with plugins like rollup-plugin-uglify, which Rollup's built-in output.banner does not. Version 0.2.1 is the latest stable release. Differentiates from output.banner by ensuring the banner survives all plugin transformations.

npm install rollup-plugin-banner
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-BANN
R
rollup-plugin-banner
devopsjavascriptv0.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.

banner
import banner from 'rollup-plugin-banner'
const banner = require('rollup-plugin-banner')
Default ESM export – CommonJS require works but is less common in Rollup configs.
banner
const banner = require('rollup-plugin-banner')
import { banner } from 'rollup-plugin-banner'
The module is a default export, not a named export.
banner
import banner from 'rollup-plugin-banner'
import * as banner from 'rollup-plugin-banner'
Namespace import is unnecessary and may cause issues.

Demonstrates adding a banner to a Rollup bundle using the default export and template strings from package.json.

import banner from 'rollup-plugin-banner'; export default { input: 'src/main.js', output: { file: 'dist/bundle.js', format: 'iife', }, plugins: [ banner('MyApp v<%= pkg.version %> by <%= pkg.author %>') ] };
Debug
Known issues
gotchaBanner is appended before the bundle content, not comments – ensure your banner string does not break JavaScript syntax.
fix
Wrap banner in comment syntax if needed, e.g., '/* My Banner */'
affects: <=0.2.1
deprecatedNo new releases since 2020; plugin may be unmaintained.
fix
Consider using Rollup's built-in output.banner if not using minification plugins that strip it, or switch to active alternatives.
affects: >=0.2.1
gotchaThe banner is added as a string literal – template interpolation uses <%= %> syntax, not backticks.
fix
Use banner('String <%= pkg.xxx %>') instead of banner(`String ${pkg.xxx}`)
affects: <=0.2.1
Errors
Common errors & fixes
Error: [object Object] is not a valid banner option
Passing an object with unknown properties (e.g., missing 'file' key).
fix
Use an object with 'file' and optional 'encoding' keys.
Cannot find module 'rollup-plugin-banner'
Plugin not installed as devDependency.
fix
Run: npm install --save-dev rollup-plugin-banner
SyntaxError: Unexpected token '<'
Using 'import' syntax in a CommonJS context without transpilation.
fix
Use const banner = require('rollup-plugin-banner') instead of import.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
rolluprequiredpeer dependency – plugin works with Rollup bundler
Agent activity
8 hits · last 30 days
node
6
Resources
rollup-plugin-banner — npm install rollup-plugin-banner · libregistry