Registry / serialization / rollup-plugin-resolve-shebang

rollup-plugin-resolve-shebang

JSON →
library1.0.1jsnpmunverified

A Rollup plugin that recognizes and preserves shebang (#!) lines in entry files, ensuring they remain at the top of the bundled output. Version 1.0.1 is current; ESM-only, requires Node.js >=18 or >=20, and Rollup >=4. Unlike alternatives that may strip or misplace shebangs, this plugin correctly retains them for CLI tools. Ships TypeScript types and has a minimal footprint.

npm install rollup-plugin-resolve-shebang
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-RESO
R
rollup-plugin-resolve-shebang
serializationjavascriptv1.0.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

resolveShebang
✓ import { resolveShebang } from 'rollup-plugin-resolve-shebang'
✗ const resolveShebang = require('rollup-plugin-resolve-shebang')
ESM-only; require() will throw ERR_REQUIRE_ESM.
default import
✓ import resolveShebangPlugin from 'rollup-plugin-resolve-shebang'
✗ import { default as resolveShebang } from 'rollup-plugin-resolve-shebang'
The package exports a named export 'resolveShebang' but also supports default import (which resolves to the named export).
TypeScript type
✓ import type { resolveShebang } from 'rollup-plugin-resolve-shebang'
Types are bundled; no separate @types package needed.

Configures Rollup to preserve shebang line from src/cli.js into the output bundle.

import { resolveShebang } from 'rollup-plugin-resolve-shebang'; export default { input: 'src/cli.js', output: { file: 'dist/cli.js', format: 'esm', }, plugins: [resolveShebang()], };
Debug
Known issues
gotchaESM-only: require() will fail on Node.js <18 or older rollup versions.
fix
Use import syntax and ensure Node.js >=18.0.0 or >=20.
affects: >=1.0.0
breakingRequires Rollup >=4; older versions of Rollup are not supported.
fix
Upgrade Rollup to version 4 or later.
affects: >=1.0.0
gotchaShebang preservation only works on the entry file; chunks may not retain shebangs.
fix
Ensure your entry file is the one with the shebang; use manualChunks if needed.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'rollup-plugin-resolve-shebang'
Package not installed or not in node_modules.
fix
Run 'npm install rollup-plugin-resolve-shebang' or 'yarn add rollup-plugin-resolve-shebang'.
TypeError: (0 , plugin_require.resolveShebang) is not a function
Using require() instead of import.
fix
Change to dynamic import: const { resolveShebang } = await import('rollup-plugin-resolve-shebang'); or use import at top level.
The 'require' of ES Module not supported.
Attempting to require() an ESM-only package.
fix
Convert your project to ESM (type: module in package.json) or use dynamic import.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
rolluprequiredpeer dependency: version >=4 is required
Agent activity
2 hits · last 30 days
node
2
Resources
rollup-plugin-resolve-shebang — npm install rollup-plugin-resolve-shebang · libregistry