Do you want your bundles generated by Parcel to have a shebang and it was easy to start from the console? This plugin allows this. You can build CLI applications in a simple way!
To install the plugin simply download the module.
You can use Yarn or npm for this.
yarn add -D parcel-plugin-shebang # Yarnnpm i -D parcel-plugin-shebang # npm
After successful installation, the plugin should work.
If you use this plugin without configuration (which is described below) it will generate for you shebang automagically. However, the plugin only works when it finds a shebang line in source files that are
entry points of Parcel.
SyntaxError. This plugin is designed to move the shebang line to the very top of the file so that it does not cause any syntax problems.
Here you can find a problem that tries to solve this plugin:
The plugin has an optional configuration that allows you to generate shebang in bundle files. This is useful if you want your source files to not have a shebang.
There are two ways to configure the plugin:
- You can use a dedicated configuration
- Alternatively, you can save the configuration in the
The configuration of the plugin is an array of objects describing the name of the interpreter and the array of files for which this interpreter is to be used.
An array can contain many objects.
If the path to the file repeats in the next object, the interpreter from the first passed object containing the given file will be used.
||string||Name of interpreter.|
||string||Array of relative paths to the files in which the interpreter is to be used.|
Now if you run the command:
parcel build ./cli.ts
The resulting file should contain a shebang with a