{"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,"search_vec":"'1.0.1':29 '18':37 '20':39 '4':42 'altern':44 'bundl':26 'cli':57 'correct':53 'current':31 'ensur':18 'entri':16 'esm':33 'esm-on':32 'file':17 'footprint':66 'javascript':67 'line':14 'may':46 'minim':65 'misplac':49 'node.js':36 'output':27 'plugin':3,8,52,71 'preserv':12 'recogn':10 'remain':20 'requir':35 'resolv':4 'retain':54 'rollup':2,7,41,68,70 'rollup-plugin':69 'rollup-plugin-resolve-shebang':1 'shebang':5,13,50,72 'ship':59 'strip':47 'tool':58 'top':23 'type':61 'typescript':60,73 'unlik':43 'version':28","created_at":"2026-04-27T17:03:56.352736+00:00","updated_at":"2026-04-27T17:03:56.352736+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-resolve-shebang","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}