Child Process Webpack Plugin
Webpack plugin for starting child processes after each build.
Installation
$ npm install child-process-webpack-plugin
Basic usage
In your webpack.config.js
:
const ChildProcessPlugin = ; moduleexports = // ... plugins: 'echo Hello!' // ...
Options
config: array | object | string
Ideally config
is an array of child process configurations. Each config is an object with the following keys:
Key | Type | Default value | Description |
---|---|---|---|
command |
String | '' |
The command to be executed |
once |
Boolean | false |
Run the command only after the first build (true makes sense only in watch mode) |
prefix |
String | '' |
Each line of the process output gets prefixed with this string |
cwd |
String | '.' |
Working directory the process will run in |
env |
Object | {PATH:process.env.PATH} |
Environment variables for the child process |
If config
is an object, it's interpreted as an array with a single configuration:
config
If config
is a string, it's interpreted as a single command:
command: config
If you don't like the array syntax, you can create multiple instances:
moduleexports = // ... plugins: config1 config2 // ...
Example
For a complete example check the test folder.