{"library":"run-script-webpack-plugin","title":"Webpack Run Script Plugin","description":"run-script-webpack-plugin is a utility Webpack plugin designed to automatically execute a specified script after Webpack completes its build process, primarily intended for development environments. As of its current stable version, 0.2.3, published approximately a year ago, the project appears to maintain a stable and perhaps slower release cadence. This plugin is particularly useful for server-side bundles, enabling automatic restarts or reloads during development workflows. A key differentiator is its strong TypeScript typing, having been re-implemented from scratch based on the functionality of start-server-webpack-plugin. It offers configurable options for passing arguments to Node.js and the script, managing auto-restarts, sending signals for Hot Module Reloading (HMR), and enabling keyboard-initiated restarts. [1, 2]","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install run-script-webpack-plugin"],"cli":null},"imports":["import { RunScriptWebpackPlugin } from 'run-script-webpack-plugin';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { RunScriptWebpackPlugin } from \"run-script-webpack-plugin\";\nimport type { Configuration } from 'webpack';\n\nconst config: Configuration = {\n  entry: {\n    server: './src/server.ts'\n  },\n  output: {\n    filename: '[name].js',\n    path: '/dist',\n  },\n  plugins: [\n    // Only use this in DEVELOPMENT\n    new RunScriptWebpackPlugin({\n      name: 'server.js',\n      nodeArgs: ['--inspect'], // allow debugging\n      args: ['scriptArgument1', 'scriptArgument2'], // pass args to script\n      autoRestart: true, // Should the script auto-restart after emit. Defaults to true.\n      signal: 'SIGUSR2', // signal to send for HMR (defaults to `false`, uses 'SIGUSR2' if `true`)\n      keyboard: true, // Allow typing 'rs' to restart the server.\n      cwd: undefined, // set a current working directory for the child process\n    }),\n  ],\n  // ... other webpack configuration (e.g., target: 'node', mode: 'development')\n};\n\nexport default config;","lang":"typescript","description":"This example demonstrates how to integrate `RunScriptWebpackPlugin` into a Webpack configuration to automatically run a compiled server-side script, enable debugging, and configure HMR signals for development.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}