Webpack plugin that automatically starts and restarts a Node.js script after webpack compilation. Version 2.0.0 requires webpack ^5.0.0 and ships TypeScript types. Key differentiators: runs scripts only on actual bundle changes (not every recompilation), supports custom script selection, watch-mode control, and process argument configuration. More efficient than nodemon/pm2 for webpack dev workflows. Actively maintained on GitHub.
npm install run-node-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Basic webpack config for Node.js server that restarts after each compilation using RunNodeWebpackPlugin.
Upgrade to webpack 5 or use run-node-webpack-plugin@1.x for webpack 4.
Explicitly set the 'scriptToRun' option to the desired output filename or external script path.
Use 'processKillSignal' option (e.g., 'SIGTERM') or handle process termination in your script.
Set 'runOnlyOnChanges' to false if you need restarts on every recompilation (e.g., when using loaders that affect output but not files).
Use default import: import RunNodeWebpackPlugin from 'run-node-webpack-plugin'
Install webpack 5: npm install webpack@^5.0.0 --save-dev
Set 'runOnlyOnChanges' to false or ensure 'scriptsToWatch' includes the correct output filenames.