Registry / devops / rollup-plugin-bin

rollup-plugin-bin

JSON →
library1.0.0jsnpmunverified

Rollup plugin that prepends an executable shebang (#!/usr/bin/env node) to the output bundle, enabling CLI scripts. Version 1.0.0, stable but minimal, with no releases since 2020. Differentiators: lightweight, no dependencies, works with any output format. Not actively maintained; alternatives include @rollup/plugin-banner or manual banner injection.

npm install rollup-plugin-bin
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-BIN
R
rollup-plugin-bin
devopsjavascriptv1.0.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.

default
import bin from 'rollup-plugin-bin'
const { bin } = require('rollup-plugin-bin')
The plugin exports a default function; named import is incorrect.
default
const bin = require('rollup-plugin-bin')
import bin from 'rollup-plugin-bin' in CommonJS
CJS require works, but ESM import also valid; preferred for modern projects.
default
const bin = require('rollup-plugin-bin').default
const bin = require('rollup-plugin-bin')
In some bundler configurations, require may return an object with default key; verify your environment.

Basic rollup config adding shebang to a CLI output file using rollup-plugin-bin.

import bin from 'rollup-plugin-bin'; export default { input: 'src/index.ts', output: { file: 'bin/cli.js', format: 'cjs' }, plugins: [bin()] };
Debug
Known issues
gotchaPlugin only prepends shebang; does not set executable permission on output file.
fix
Use chmod +x after build, or configure output.permissions in rollup.
affects: >=1.0.0
gotchaNo support for custom shebang strings other than default #!/usr/bin/env node.
fix
Use @rollup/plugin-banner with custom shebang or fork plugin.
affects: >=1.0.0
breakingDeprecated: Plugin is not actively maintained; may break with future rollup versions.
fix
Consider migrating to @rollup/plugin-banner or include banner manually via output.banner.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: bin is not a function
Named import (import { bin } from 'rollup-plugin-bin') instead of default import.
fix
Use import bin from 'rollup-plugin-bin' or const bin = require('rollup-plugin-bin').default.
Error: Cannot find module 'rollup-plugin-bin'
Package not installed or improper import path.
fix
Run npm install rollup-plugin-bin --save-dev and ensure correct require/import.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Resources
rollup-plugin-bin — npm install rollup-plugin-bin · libregistry