Skip to content

A Rollup plugin that preserves shebangs (#!/usr/bin/env node) in output files

License

Notifications You must be signed in to change notification settings

elado/rollup-plugin-preserve-shebangs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

// rollup.config.js

const { preserveShebangs } = require('rollup-plugin-preserve-shebangs');

module.exports = {
  // ...
  plugins: [
    // ...
    preserveShebangs(),
  ],
};

About

A Rollup plugin that preserves shebangs (#!/usr/bin/env node) in output files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published