Rollup plugin that prepends a shebang line (e.g., #!/usr/bin/env node) to output files. v0.3.1 is the latest stable release (last updated July 2019). It automatically adds shebangs to matched files after bundling, supporting include/exclude patterns and custom shebang strings or functions. Unlike alternatives, it works with code splitting and doesn't require modifying source files. Currently in maintenance mode with no recent updates.
npm install rollup-plugin-add-shebangVerified import paths — ran on the pinned version, not inferred.
Configures Rollup to add a Node.js shebang to output files matching cli.js or bin.js patterns.
Always start shebang with #! and ensure correct interpreter path.
Refer to changelog for function signature; the function receives the file path and should return a string.
Use source-level shebangs or another plugin if you need shebangs in source files.
Set output.format to 'cjs' or 'umd' when targeting Node.js CLI tools.
Pass a string like '#!/usr/bin/env node' or a function returning a string.
Use default import: import shebang from 'rollup-plugin-add-shebang'
Run npm install --save-dev rollup-plugin-add-shebang