https://github.com/elado/rollup-plugin-preserve-shebangs
A Rollup plugin that preserves shebangs (#!/usr/bin/env node) in output files
https://github.com/elado/rollup-plugin-preserve-shebangs
rollup rollup-plugin shebang
Last synced: about 1 month ago
JSON representation
A Rollup plugin that preserves shebangs (#!/usr/bin/env node) in output files
- Host: GitHub
- URL: https://github.com/elado/rollup-plugin-preserve-shebangs
- Owner: elado
- License: mit
- Created: 2019-10-22T03:30:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:20:47.000Z (over 2 years ago)
- Last Synced: 2024-10-12T00:38:47.802Z (7 months ago)
- Topics: rollup, rollup-plugin, shebang
- Language: TypeScript
- Homepage:
- Size: 436 KB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-preserve-shebangs
> A Rollup plugin that preserves shebangs (#!/usr/bin/env node) in output files
## Why?
Package executables (under `bin` in package.json) need _shebang_ `#!/usr/bin/env node` at the top of the file.
With that line, rollup errors:
```
Error: Unexpected character '#'
```This plugin removes the shebang before compilation, and restores it before writing the file.
## Install
```
npm i -D rollup-plugin-preserve-shebangs
# or, with yarn
yarn add -D rollup-plugin-preserve-shebangs
```## Usage
```js
// rollup.config.jsconst { preserveShebangs } = require('rollup-plugin-preserve-shebangs');
module.exports = {
// ...
plugins: [
// ...
preserveShebangs(),
],
};
```