{"id":22203,"library":"rollup-plugin-resolve-shebang","title":"rollup-plugin-resolve-shebang","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com//mister-hope/rollup-plugin-resolve-shebang","tags":["javascript","rollup","rollup-plugin","shebang","typescript"],"install":[{"cmd":"npm install rollup-plugin-resolve-shebang","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-resolve-shebang","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-resolve-shebang","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: version >=4 is required","package":"rollup","optional":false}],"imports":[{"note":"ESM-only; require() will throw ERR_REQUIRE_ESM.","wrong":"const resolveShebang = require('rollup-plugin-resolve-shebang')","symbol":"resolveShebang","correct":"import { resolveShebang } from 'rollup-plugin-resolve-shebang'"},{"note":"The package exports a named export 'resolveShebang' but also supports default import (which resolves to the named export).","wrong":"import { default as resolveShebang } from 'rollup-plugin-resolve-shebang'","symbol":"default import","correct":"import resolveShebangPlugin from 'rollup-plugin-resolve-shebang'"},{"note":"Types are bundled; no separate @types package needed.","wrong":null,"symbol":"TypeScript type","correct":"import type { resolveShebang } from 'rollup-plugin-resolve-shebang'"}],"quickstart":{"code":"import { resolveShebang } from 'rollup-plugin-resolve-shebang';\n\nexport default {\n  input: 'src/cli.js',\n  output: {\n    file: 'dist/cli.js',\n    format: 'esm',\n  },\n  plugins: [resolveShebang()],\n};","lang":"typescript","description":"Configures Rollup to preserve shebang line from src/cli.js into the output bundle."},"warnings":[{"fix":"Use import syntax and ensure Node.js >=18.0.0 or >=20.","message":"ESM-only: require() will fail on Node.js <18 or older rollup versions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Rollup to version 4 or later.","message":"Requires Rollup >=4; older versions of Rollup are not supported.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your entry file is the one with the shebang; use manualChunks if needed.","message":"Shebang preservation only works on the entry file; chunks may not retain shebangs.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install rollup-plugin-resolve-shebang' or 'yarn add rollup-plugin-resolve-shebang'.","cause":"Package not installed or not in node_modules.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'rollup-plugin-resolve-shebang'"},{"fix":"Change to dynamic import: const { resolveShebang } = await import('rollup-plugin-resolve-shebang'); or use import at top level.","cause":"Using require() instead of import.","error":"TypeError: (0 , plugin_require.resolveShebang) is not a function"},{"fix":"Convert your project to ESM (type: module in package.json) or use dynamic import.","cause":"Attempting to require() an ESM-only package.","error":"The 'require' of ES Module not supported."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}