Registry / web-framework / rollup-plugin-strip-banner

rollup-plugin-strip-banner

JSON →
library3.1.0jsnpmunverified

Rollup plugin to remove banner comments (e.g., license headers) from module files before bundling. Current stable version is 3.1.0, released with support for Rollup 4.x. Released irregularly, with major version bumps aligning with Rollup peer dependency updates. Key differentiator: lightweight, focused solely on banner stripping without additional transforms. Alternatives like rollup-plugin-terser or manual regex require more configuration. Ships TypeScript types.

npm install rollup-plugin-strip-banner
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-STRI
R
rollup-plugin-strip-banner
web-frameworkjavascriptv3.1.0
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.

stripBanner
import stripBanner from 'rollup-plugin-strip-banner'
import { stripBanner } from 'rollup-plugin-strip-banner'
Default export; named import causes undefined. ESM since v3 (supports ESM/CJS).
stripBanner (CommonJS)
const stripBanner = require('rollup-plugin-strip-banner')
const { stripBanner } = require('rollup-plugin-strip-banner')
CJS require returns the default export as a function; destructuring fails.
stripBanner with TypeScript
import stripBanner from 'rollup-plugin-strip-banner'
TypeScript types are included; works with ESM imports. For CJS projects, ensure esModuleInterop is enabled.

Configures rollup-plugin-strip-banner in a Rollup config file with include/exclude patterns.

// rollup.config.js import stripBanner from 'rollup-plugin-strip-banner'; import { defineConfig } from 'rollup'; export default defineConfig({ input: 'src/index.js', output: { file: 'dist/index.js', format: 'esm' }, plugins: [ stripBanner({ include: '**/*.js', exclude: 'node_modules/**' }) ] });
Debug
Known issues
deprecatedrollup-plugin-strip-banner is deprecated; consider using a custom Rollup transform instead.
fix
Use rollup-plugin-strip-banner at your own risk or implement a simple plugin that removes banner comments via regex or AST.
affects: >=3.0.0
breakingVersion 3.0.0 drops support for Node <14.
fix
Upgrade Node to version 14 or later.
affects: >=3.0.0
breakingVersion 2.0.0 drops support for Node <10 and Rollup <2.
fix
Use Rollup >=2 and Node >=10.
affects: >=2.0.0 <3.0.0
gotchaThe plugin may incorrectly remove banners that are not at the very top of the file (e.g., leading comments after shebang).
fix
Ensure banners are at the top of the module before you trust stripping; consider verifying output.
affects: *
breakingVersion 1.0.0 includes a fix for sourcemap generation; previous versions may produce faulty sourcemaps.
fix
Upgrade to >=1.0.0 to avoid sourcemap issues.
affects: <1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-strip-banner'
Deprecation: the package is not actively maintained and may have been removed from npm or not installed.
fix
npm install rollup-plugin-strip-banner --save-dev
TypeError: stripBanner is not a function
Using named import 'stripBanner' instead of default import.
fix
Use import stripBanner from 'rollup-plugin-strip-banner' (default import) instead of import { stripBanner } from 'rollup-plugin-strip-banner' (named import).
The 'include' and 'exclude' options are not working as expected
Misunderstanding of minimatch patterns or order of precedence.
fix
Ensure include/exclude follow minimatch glob patterns; exclude overrides include. Use absolute or relative paths correctly.
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
rolluprequiredPeer dependency – the plugin is designed to work as a Rollup plugin and expects Rollup to be installed.
Agent activity
10 hits · last 30 days
node
8
Resources
rollup-plugin-strip-banner — npm install rollup-plugin-strip-banner · libregistry