Registry / devops / webpack-spawn-plugin

webpack-spawn-plugin

JSON →
library0.3.0jsnpmunverified

A webpack plugin that runs child_process.spawn during compilation, useful for running shell commands or starting processes as part of the build pipeline. The latest stable version is 0.3.0, released infrequently with last update in 2018. It supports Webpack 4+ hooks via the 'when' option (default 'done') and offers a 'persistent' flag to avoid respawning on recompilation. Compared to alternatives like webpack-shell-plugin or webpack-exec-plugin, this one directly uses Node's spawn for more control over stdio and process handling.

npm install webpack-spawn-plugin
INSTALL
IMPORT
SIG · WEBPACK-SPAWN-PLUG
W
webpack-spawn-plugin
devopsjavascriptv0.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import SpawnPlugin from 'webpack-spawn-plugin'
const SpawnPlugin = require('webpack-spawn-plugin')
Default export is a class; CommonJS require works but TypeScript may need esModuleInterop.

Shows basic usage: import the plugin, create a new instance with command and arguments, and add to plugins array.

import SpawnPlugin from 'webpack-spawn-plugin'; export default { entry: './src/index.js', output: { filename: 'bundle.js' }, plugins: [ new SpawnPlugin('node', ['-e', "console.log('Hello from webpack-spawn-plugin!'); process.exit(0);"], { persistent: false }), ], };
Debug
Known issues
breakingVersion 0.2.0 updated to new Webpack API (hooks). If using Webpack <4, the plugin will not work.
fix
Use webpack 4+ or stick with v0.1.x for older webpack versions.
affects: >=0.2.0
gotchaThe plugin uses child_process.spawn synchronously under the hood; long-running processes may block the build.
fix
Use 'persistent: true' to avoid respawning on rebuilds, but beware that the process may linger.
affects: >=0.0.0
deprecatedThe 'persistent' option added in v0.2.1 may cause zombie processes if not handled correctly.
fix
Manually manage the child process reference and kill it when done.
affects: >=0.2.1
Errors
Common errors & fixes
TypeError: SpawnPlugin is not a constructor
Using CommonJS require without proper default import handling.
fix
Use `const SpawnPlugin = require('webpack-spawn-plugin').default;` or enable esModuleInterop in tsconfig.
Error: Cannot find module 'webpack-spawn-plugin'
Package not installed or not in node_modules.
fix
Run `npm install --save-dev webpack-spawn-plugin`.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
webpack-spawn-plugin — npm install webpack-spawn-plugin · libregistry