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-bannerVerified import paths — ran on the pinned version, not inferred.
Demonstrates adding a banner to a Rollup bundle using the default export and template strings from package.json.
Wrap banner in comment syntax if needed, e.g., '/* My Banner */'
Consider using Rollup's built-in output.banner if not using minification plugins that strip it, or switch to active alternatives.
Use banner('String <%= pkg.xxx %>') instead of banner(`String ${pkg.xxx}`)Use an object with 'file' and optional 'encoding' keys.
Run: npm install --save-dev rollup-plugin-banner
Use const banner = require('rollup-plugin-banner') instead of import.