{"id":20827,"library":"webpack-shell-plugin-next","title":"webpack-shell-plugin-next","description":"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.","status":"active","version":"2.3.3","language":"javascript","source_language":"en","source_url":"https://github.com/s00d/webpack-shell-plugin-next","tags":["javascript","webpack","shell","plugin","serve","hmr","browser","script","typescript"],"install":[{"cmd":"npm install webpack-shell-plugin-next","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-shell-plugin-next","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-shell-plugin-next","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin uses webpack's compiler hooks API","package":"webpack","optional":false}],"imports":[{"note":"This package is CommonJS-only (no ESM export). In TypeScript, use the require syntax or set 'esModuleInterop' to true if using import.","wrong":"import WebpackShellPluginNext from 'webpack-shell-plugin-next';","symbol":"WebpackShellPluginNext","correct":"const WebpackShellPluginNext = require('webpack-shell-plugin-next');"},{"note":"TypeScript users should use import x = require() for CommonJS modules; named import is not available.","wrong":"import { WebpackShellPluginNext } from 'webpack-shell-plugin-next';","symbol":"WebpackShellPluginNext","correct":"import WebpackShellPluginNext = require('webpack-shell-plugin-next');"},{"note":"Since v2, lifecycle hooks expect a configuration object with 'scripts' array, not an array of strings directly.","wrong":"new WebpackShellPluginNext({ onBuildStart: ['echo start'] })","symbol":"Plugin configuration object","correct":"new WebpackShellPluginNext({ onBuildStart: { scripts: ['echo start'], blocking: true } })"}],"quickstart":{"code":"const WebpackShellPluginNext = require('webpack-shell-plugin-next');\n\nmodule.exports = {\n  plugins: [\n    new WebpackShellPluginNext({\n      onBuildStart: {\n        scripts: ['echo \"Build starting...\"'],\n        blocking: true,\n        parallel: false\n      },\n      onBuildEnd: {\n        scripts: ['echo \"Build completed!\"'],\n        blocking: false,\n        parallel: true\n      },\n      onBuildExit: {\n        scripts: ['echo \"Exiting webpack\"']\n      },\n      onWatchRun: {\n        scripts: ['echo \"Watch mode triggered\"'],\n        blocking: false\n      },\n      env: { NODE_ENV: 'production' },\n      logging: true,\n      swallowError: false\n    })\n  ]\n};","lang":"javascript","description":"Configures the plugin with multiple lifecycle hooks, blocking/parallel options, environment variables, and logging control."},"warnings":[{"fix":"Upgrade to webpack 5 or use v1.x (webpack-shell-plugin-next@1) for webpack 4.","message":"v2.0.0 dropped webpack 4 support. Only webpack 5 is supported.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Change from `onBuildStart: ['echo start']` to `onBuildStart: { scripts: ['echo start'] }`.","message":"v2.0.0 changed configuration structure: lifecycle hooks now expect an object (with scripts array) instead of a flat array.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Replace `onBeforeBuild` with `onBuildStart`, `onBuildError` with `onFailedBuild`.","message":"The `onBeforeBuild` and `onBuildError` hooks are deprecated in v2. Use `onBuildStart` and `onFailedBuild` instead.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Set only one of them to true, or both to false.","message":"Using both `blocking: true` and `parallel: true` together throws an error: they are mutually exclusive.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use `onBeforeNormalRun` or `onDoneWatch` for more precise control.","message":"The `onBuildExit` hook also fires in watch mode when webpack finishes updating the bundle, not just on exit.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.3.3':19 '5':14,59 'activ':45 'block':39 'browser':74 'build':15 'command':8 'compat':55 'control':43 'current':16 'differenti':44 'etc':37 'execut':42 'fine':29 'fine-grain':28 'fork':47 'grain':30 'hmr':73 'hook':32,64 'javascript':68 'lifecycl':31 'maintain':46 'next':5 'offer':62 'onbuildend':34 'onbuildexit':35 'onbuildstart':33 'onwatchrun':36 'origin':50 'parallel':41 'plugin':4,54,71 'provid':27 'regular':21 'run':6 'script':75 'serv':72 'shell':3,7,53,70 'stabl':17 'support':23,67 'type':25 'typescript':24,66,76 'updat':22 'v2.x':60 'version':18 'webpack':2,13,52,58,69 'webpack-shell-plugin':51 'webpack-shell-plugin-next':1","created_at":"2026-04-25T11:25:11.229109+00:00","updated_at":"2026-04-25T11:25:11.229109+00:00","problems":[{"fix":"Replace `import WebpackShellPluginNext from 'webpack-shell-plugin-next'` with `const WebpackShellPluginNext = require('webpack-shell-plugin-next')`.","cause":"ESM import used incorrectly; package is CommonJS.","error":"TypeError: WebpackShellPluginNext is not a constructor"},{"fix":"Run `npm install --save-dev webpack-shell-plugin-next` and ensure webpack 5 is installed.","cause":"Missing npm install or wrong peer dependency webpack version.","error":"Cannot find module 'webpack-shell-plugin-next'"},{"fix":"Ensure each lifecycle hook's scripts property is an array, e.g., `onBuildStart: { scripts: ['command'] }`.","cause":"Configuration for a lifecycle hook was passed as a string or invalid type.","error":"Error: the scripts option should be an array of strings"},{"fix":"Set at most one of them to true, or leave both false (defaults to serial non-blocking).","cause":"Both blocking and parallel options set to true in a lifecycle config.","error":"Error: blocking and parallel cannot both be true"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/s00d/webpack-shell-plugin-next","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-shell-plugin-next","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}