Registry / devops / webpack-electron-reload

webpack-electron-reload

JSON →
library1.0.1jsnpmunverified

Webpack plugin that automatically restarts the Electron main process when webpack recompiles. Version 1.0.1, no recent updates. It is a lightweight alternative to electron-reload-webpack-plugin, requiring Electron as a peer dependency. The plugin is used with webpack's watch mode and integrates into the webpack build lifecycle. Suitable for development workflows where quick iteration on the Electron main process is needed.

npm install webpack-electron-reload
INSTALL
IMPORT
SIG · WEBPACK-ELECTRON-R
W
webpack-electron-reload
devopsjavascriptv1.0.1
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.

ElectronReloadPlugin (default export as a factory function)
const ElectronReloadPlugin = require('webpack-electron-reload')({ path: '...' });
import ElectronReloadPlugin from 'webpack-electron-reload'; // causes runtime error because the export is a factory function
The package exports a factory function that must be called with options immediately; the return value is the actual plugin constructor.
Plugin usage in webpack config
plugins: [ ElectronReloadPlugin() ]
plugins: [ ElectronReloadPlugin ] // forgetting to call the factory function will pass the factory instead of plugin instance
The factory function returns a plugin class; instantiate it with 'new' or simply call it (it returns a new instance).
ESM import (experimental or with bundler)
import webpackElectronReload from 'webpack-electron-reload'; const ElectronReloadPlugin = webpackElectronReload({ path: '...' });
import { ElectronReloadPlugin } from 'webpack-electron-reload'; // named export does not exist
Only a default export exists; it is a function that takes options and returns a plugin class.

Shows how to add the plugin to webpack config with path to Electron entry point, then run webpack in watch mode.

// webpack.config.js const path = require('path'); const ElectronReloadPlugin = require('webpack-electron-reload')({ path: path.join(__dirname, './dist/main.js'), }); module.exports = { target: 'electron-main', entry: './src/main.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'main.js', }, plugins: [ ElectronReloadPlugin(), ], }; // Run with: webpack --watch
Debug
Known issues
gotchaPath option must be absolute or relative to project root; relative paths are resolved from process.cwd().
fix
Use path.join(__dirname, './dist/main.js') or path.resolve('./dist/main.js') for reliable absolute path.
affects: >=0.0.0
gotchaThe plugin only restarts Electron when webpack recompiles; it does not trigger a restart on initial build.
fix
Ensure Electron is started manually for the first build or use a script that starts webpack and electron sequentially.
affects: >=0.0.0
breakingThe plugin's factory function must be called with options at import time (not lazily), otherwise the plugin will not work.
fix
Always call the require result immediately with options: const pluginFactory = require('webpack-electron-reload')(options);
affects: >=0.0.0
Errors
Common errors & fixes
ElectronReloadPlugin is not a constructor
Forgetting to call the factory function with options before instantiating.
fix
Use: const pluginFactory = require('webpack-electron-reload')({path: '...'});  plugins: [ pluginFactory() ];
ENOENT: no such file or directory, stat '.../dist/main.js'
The path option points to a non-existing file (electron entry point not built yet).
fix
Ensure the output file exists before webpack watch starts, or use a build step that compiles before watch.
Cannot find module 'electron'
Electron is not installed or not in node_modules.
fix
Run 'npm install electron --save-dev' (or '--save') as the package requires Electron as a peer dependency.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
electronrequiredpeer dependency required to spawn/restart Electron process; must be installed separately
Agent activity
9 hits · last 30 days
node
8
Resources
webpack-electron-reload — npm install webpack-electron-reload · libregistry