Registry / devops / webpack-shell-plugin

webpack-shell-plugin

JSON →
library0.5.0jsnpmunverified

A webpack plugin that executes shell commands before and after webpack builds. Version 0.5.0 requires webpack 4+ (peer dependency). It supports arrays of commands for start, end, and exit phases, and provides a 'dev' mode to avoid re-running scripts in watch/watch-dev-server. Unlike alternatives like shelljs-webpack-plugin, it uses spawn by default but offers a 'safe' flag to fall back to exec. The plugin is unmaintained since 2019 and may have issues with webpack 5.

npm install webpack-shell-plugin
INSTALL
IMPORT
SIG · WEBPACK-SHELL-PLUG
W
webpack-shell-plugin
devopsjavascriptv0.5.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.

WebpackShellPlugin
const WebpackShellPlugin = require('webpack-shell-plugin');
import WebpackShellPlugin from 'webpack-shell-plugin';
Package does not ship ESM; use CommonJS require. For TypeScript, you may need to install @types/webpack-shell-plugin or use require with no types.

Shows how to use WebpackShellPlugin with all three hooks (start, end, exit) in a webpack config.

const WebpackShellPlugin = require('webpack-shell-plugin'); const path = require('path'); module.exports = { entry: path.resolve(__dirname, 'src/app.js'), output: { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js' }, plugins: [ new WebpackShellPlugin({ onBuildStart: ['echo "Build started"'], onBuildEnd: ['echo "Build ended"'], onBuildExit: ['echo "Webpack process complete"'], dev: false }) ] };
Debug
Known issues
deprecatedThe 'verbose' option is deprecated and has no effect.
fix
Remove the verbose option from the plugin configuration.
affects: >=0.3.0
gotchaOn Windows, spawn may fail due to shell differences. Use the 'safe' option to switch to exec which uses cmd.
fix
Add { safe: true } to options.
affects: >=0.5.0
gotchaThe plugin does not expose a return value for scripts; any errors may not be caught.
fix
Wrap scripts in try-catch or redirect stderr to a log.
affects: >=0.5.0
breakingPlugin may not work with webpack 5 without modification due to removed legacy plugin API.
fix
Use a fork like 'webpack-shell-plugin-next' or upgrade to a maintained plugin.
affects: >=0.5.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack-shell-plugin'
Module not installed or incorrect import path.
fix
Run 'npm install --save-dev webpack-shell-plugin' and use require('webpack-shell-plugin') in webpack.config.js.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency - plugin hooks into webpack compilation lifecycle
Agent activity
9 hits · last 30 days
node
8
Resources
webpack-shell-plugin — npm install webpack-shell-plugin · libregistry