Registry / devops / webpack-shell-plugin-next

webpack-shell-plugin-next

JSON →
library2.3.3jsnpmunverified

Run shell commands before, during, and after webpack 5 builds. Current stable version 2.3.3, with regular updates. Supports TypeScript types and provides fine-grained lifecycle hooks (onBuildStart, onBuildEnd, onBuildExit, onWatchRun, etc.) with blocking and parallel execution control. Differentiator: actively maintained fork of the original webpack-shell-plugin, compatible only with webpack 5 (v2.x) and offering more hooks and TypeScript support.

npm install webpack-shell-plugin-next
INSTALL
IMPORT
SIG · WEBPACK-SHELL-PLUG
W
webpack-shell-plugin-next
devopsjavascriptv2.3.3
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

WebpackShellPluginNext
✓ const WebpackShellPluginNext = require('webpack-shell-plugin-next');
✗ import WebpackShellPluginNext from 'webpack-shell-plugin-next';
This package is CommonJS-only (no ESM export). In TypeScript, use the require syntax or set 'esModuleInterop' to true if using import.
WebpackShellPluginNext
✓ import WebpackShellPluginNext = require('webpack-shell-plugin-next');
✗ import { WebpackShellPluginNext } from 'webpack-shell-plugin-next';
TypeScript users should use import x = require() for CommonJS modules; named import is not available.
Plugin configuration object
✓ new WebpackShellPluginNext({ onBuildStart: { scripts: ['echo start'], blocking: true } })
✗ new WebpackShellPluginNext({ onBuildStart: ['echo start'] })
Since v2, lifecycle hooks expect a configuration object with 'scripts' array, not an array of strings directly.

Configures the plugin with multiple lifecycle hooks, blocking/parallel options, environment variables, and logging control.

const WebpackShellPluginNext = require('webpack-shell-plugin-next'); module.exports = { plugins: [ new WebpackShellPluginNext({ onBuildStart: { scripts: ['echo "Build starting..."'], blocking: true, parallel: false }, onBuildEnd: { scripts: ['echo "Build completed!"'], blocking: false, parallel: true }, onBuildExit: { scripts: ['echo "Exiting webpack"'] }, onWatchRun: { scripts: ['echo "Watch mode triggered"'], blocking: false }, env: { NODE_ENV: 'production' }, logging: true, swallowError: false }) ] };
Debug
Known issues
breakingv2.0.0 dropped webpack 4 support. Only webpack 5 is supported.
fix
Upgrade to webpack 5 or use v1.x (webpack-shell-plugin-next@1) for webpack 4.
affects: >=2.0.0
breakingv2.0.0 changed configuration structure: lifecycle hooks now expect an object (with scripts array) instead of a flat array.
fix
Change from `onBuildStart: ['echo start']` to `onBuildStart: { scripts: ['echo start'] }`.
affects: >=2.0.0
deprecatedThe `onBeforeBuild` and `onBuildError` hooks are deprecated in v2. Use `onBuildStart` and `onFailedBuild` instead.
fix
Replace `onBeforeBuild` with `onBuildStart`, `onBuildError` with `onFailedBuild`.
affects: >=2.0.0
gotchaUsing both `blocking: true` and `parallel: true` together throws an error: they are mutually exclusive.
fix
Set only one of them to true, or both to false.
affects: >=1.0.0
gotchaThe `onBuildExit` hook also fires in watch mode when webpack finishes updating the bundle, not just on exit.
fix
Use `onBeforeNormalRun` or `onDoneWatch` for more precise control.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: WebpackShellPluginNext is not a constructor
ESM import used incorrectly; package is CommonJS.
fix
Replace `import WebpackShellPluginNext from 'webpack-shell-plugin-next'` with `const WebpackShellPluginNext = require('webpack-shell-plugin-next')`.
Cannot find module 'webpack-shell-plugin-next'
Missing npm install or wrong peer dependency webpack version.
fix
Run `npm install --save-dev webpack-shell-plugin-next` and ensure webpack 5 is installed.
Error: the scripts option should be an array of strings
Configuration for a lifecycle hook was passed as a string or invalid type.
fix
Ensure each lifecycle hook's scripts property is an array, e.g., `onBuildStart: { scripts: ['command'] }`.
Error: blocking and parallel cannot both be true
Both blocking and parallel options set to true in a lifecycle config.
fix
Set at most one of them to true, or leave both false (defaults to serial non-blocking).
Upgrade
Version history
2.3.3latest on npm
Audit
Dependencies
webpackrequiredpeer dependency; plugin uses webpack's compiler hooks API
Agent activity
9 hits · last 30 days
node
8
Resources
webpack-shell-plugin-next — npm install webpack-shell-plugin-next · libregistry