Registry / devops / run-node-webpack-plugin

run-node-webpack-plugin

JSON →
library2.0.0jsnpmunverified

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-plugin
INSTALL
IMPORT
SIG · RUN-NODE-WEBPACK-P
R
run-node-webpack-plugin
devopsjavascriptv2.0.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.

RunNodeWebpackPlugin
import RunNodeWebpackPlugin from 'run-node-webpack-plugin'
const { RunNodeWebpackPlugin } = require('run-node-webpack-plugin')
Default export; must use default import. Named import or destructured require will fail.
RunNodeWebpackPlugin (CommonJS)
const RunNodeWebpackPlugin = require('run-node-webpack-plugin');
CJS require is supported; the default export is the plugin constructor.
Types (if needed)
import RunNodeWebpackPlugin from 'run-node-webpack-plugin';
import { RunNodeWebpackPluginOptions } from 'run-node-webpack-plugin'
TypeScript types are bundled but not exported as named types; use default import and infer types from constructor.

Basic webpack config for Node.js server that restarts after each compilation using RunNodeWebpackPlugin.

const RunNodeWebpackPlugin = require('run-node-webpack-plugin'); const path = require('path'); module.exports = { target: 'node', entry: './src/server.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'server.js' }, plugins: [ new RunNodeWebpackPlugin() ] };
Debug
Known issues
breakingVersion 2.x requires webpack 5; incompatible with webpack 4.
fix
Upgrade to webpack 5 or use run-node-webpack-plugin@1.x for webpack 4.
affects: >=2.0.0
gotchaDefault script selection may fail if multiple output files exist and neither 'server.js' nor 'index.js' is among them.
fix
Explicitly set the 'scriptToRun' option to the desired output filename or external script path.
affects: >=1.0.0
gotchaPlugin does not kill child processes gracefully by default; process may remain running if webpack exits abruptly.
fix
Use 'processKillSignal' option (e.g., 'SIGTERM') or handle process termination in your script.
affects: >=1.0.0
gotchaWhen 'runOnlyOnChanges' is true (default), script restarts only if output files change; watch mode with no file changes will not restart.
fix
Set 'runOnlyOnChanges' to false if you need restarts on every recompilation (e.g., when using loaders that affect output but not files).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: RunNodeWebpackPlugin is not a constructor
Using named import instead of default import in ESM context.
fix
Use default import: import RunNodeWebpackPlugin from 'run-node-webpack-plugin'
Error: Cannot find module 'webpack'
Webpack is not installed or version mismatch (plugin expects webpack 5).
fix
Install webpack 5: npm install webpack@^5.0.0 --save-dev
The plugin does not restart the script after changes
Default 'runOnlyOnChanges' is true but no changes detected in watched scripts, or 'scriptsToWatch' may not include the changed file.
fix
Set 'runOnlyOnChanges' to false or ensure 'scriptsToWatch' includes the correct output filenames.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
webpackrequiredPeer dependency; plugin is designed as a webpack plugin and requires webpack 5+
Agent activity
8 hits · last 30 days
node
8
Resources
run-node-webpack-plugin — npm install run-node-webpack-plugin · libregistry