{"id":21924,"library":"rollup-plugin-banner","title":"rollup-plugin-banner","description":"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.","status":"active","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/yingye/rollup-plugin-banner","tags":["javascript","rollup","rollup-plugin","banner","license"],"install":[{"cmd":"npm install rollup-plugin-banner","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-banner","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-banner","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency – plugin works with Rollup bundler","package":"rollup","optional":false}],"imports":[{"note":"Default ESM export – CommonJS require works but is less common in Rollup configs.","wrong":"const banner = require('rollup-plugin-banner')","symbol":"banner","correct":"import banner from 'rollup-plugin-banner'"},{"note":"The module is a default export, not a named export.","wrong":"import { banner } from 'rollup-plugin-banner'","symbol":"banner","correct":"const banner = require('rollup-plugin-banner')"},{"note":"Namespace import is unnecessary and may cause issues.","wrong":"import * as banner from 'rollup-plugin-banner'","symbol":"banner","correct":"import banner from 'rollup-plugin-banner'"}],"quickstart":{"code":"import banner from 'rollup-plugin-banner';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife',\n  },\n  plugins: [\n    banner('MyApp v<%= pkg.version %> by <%= pkg.author %>')\n  ]\n};","lang":"javascript","description":"Demonstrates adding a banner to a Rollup bundle using the default export and template strings from package.json."},"warnings":[{"fix":"Wrap banner in comment syntax if needed, e.g., '/* My Banner */'","message":"Banner is appended before the bundle content, not comments – ensure your banner string does not break JavaScript syntax.","severity":"gotcha","affected_versions":"<=0.2.1"},{"fix":"Consider using Rollup's built-in output.banner if not using minification plugins that strip it, or switch to active alternatives.","message":"No new releases since 2020; plugin may be unmaintained.","severity":"deprecated","affected_versions":">=0.2.1"},{"fix":"Use banner('String <%= pkg.xxx %>') instead of banner(`String ${pkg.xxx}`)","message":"The banner is added as a string literal – template interpolation uses <%= %> syntax, not backticks.","severity":"gotcha","affected_versions":"<=0.2.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use an object with 'file' and optional 'encoding' keys.","cause":"Passing an object with unknown properties (e.g., missing 'file' key).","error":"Error: [object Object] is not a valid banner option"},{"fix":"Run: npm install --save-dev rollup-plugin-banner","cause":"Plugin not installed as devDependency.","error":"Cannot find module 'rollup-plugin-banner'"},{"fix":"Use const banner = require('rollup-plugin-banner') instead of import.","cause":"Using 'import' syntax in a CommonJS context without transpilation.","error":"SyntaxError: Unexpected token '<'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}