{"id":20828,"library":"webpack-shell-plugin","title":"Webpack Shell Plugin","description":"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.","status":"maintenance","version":"0.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/1337programming/webpack-shell-plugin","tags":["javascript","webpack","shell","plugin","serve","hmr","browser","script"],"install":[{"cmd":"npm install webpack-shell-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-shell-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-shell-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - plugin hooks into webpack compilation lifecycle","package":"webpack","optional":false}],"imports":[{"note":"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.","wrong":"import WebpackShellPlugin from 'webpack-shell-plugin';","symbol":"WebpackShellPlugin","correct":"const WebpackShellPlugin = require('webpack-shell-plugin');"}],"quickstart":{"code":"const WebpackShellPlugin = require('webpack-shell-plugin');\nconst path = require('path');\n\nmodule.exports = {\n  entry: path.resolve(__dirname, 'src/app.js'),\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new WebpackShellPlugin({\n      onBuildStart: ['echo \"Build started\"'],\n      onBuildEnd: ['echo \"Build ended\"'],\n      onBuildExit: ['echo \"Webpack process complete\"'],\n      dev: false\n    })\n  ]\n};","lang":"javascript","description":"Shows how to use WebpackShellPlugin with all three hooks (start, end, exit) in a webpack config."},"warnings":[{"fix":"Remove the verbose option from the plugin configuration.","message":"The 'verbose' option is deprecated and has no effect.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Add { safe: true } to options.","message":"On Windows, spawn may fail due to shell differences. Use the 'safe' option to switch to exec which uses cmd.","severity":"gotcha","affected_versions":">=0.5.0"},{"fix":"Wrap scripts in try-catch or redirect stderr to a log.","message":"The plugin does not expose a return value for scripts; any errors may not be caught.","severity":"gotcha","affected_versions":">=0.5.0"},{"fix":"Use a fork like 'webpack-shell-plugin-next' or upgrade to a maintained plugin.","message":"Plugin may not work with webpack 5 without modification due to removed legacy plugin API.","severity":"breaking","affected_versions":">=0.5.0"}],"env_vars":null,"search_vec":"'0.5.0':17 '2019':74 '4':20 '5':81 'altern':48 'array':25 'avoid':40 'back':66 'browser':88 'build':15 'command':10,27 'default':58 'depend':22 'dev':37 'end':30 'exec':68 'execut':8 'exit':32 'fall':65 'flag':63 'hmr':87 'issu':78 'javascript':82 'like':49 'may':76 'mode':38 'offer':60 'peer':21 'phase':33 'plugin':3,6,53,70,85 'provid':35 're':42 're-run':41 'requir':18 'run':43 'safe':62 'script':44,89 'serv':86 'shell':2,9,84 'shellj':51 'shelljs-webpack-plugin':50 'sinc':73 'spawn':56 'start':29 'support':24 'unlik':47 'unmaintain':72 'use':55 'version':16 'watch/watch-dev-server':46 'webpack':1,5,14,19,52,80,83","created_at":"2026-04-25T11:25:11.559023+00:00","updated_at":"2026-04-25T11:25:11.559023+00:00","problems":[{"fix":"Run 'npm install --save-dev webpack-shell-plugin' and use require('webpack-shell-plugin') in webpack.config.js.","cause":"Module not installed or incorrect import path.","error":"Error: Cannot find module 'webpack-shell-plugin'"}],"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/1337programming/webpack-shell-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-shell-plugin","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}}