Registry /
devops / webpack-electron-reload
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
muslnode 18–226 runs
build_error
glibcnode 18–226 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
Errors
Common errors & fixes
ElectronReloadPlugin is not a constructor
Forgetting to call the factory function with options before instantiating.
fixUse: 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).
fixEnsure 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.
fixRun 'npm install electron --save-dev' (or '--save') as the package requires Electron as a peer dependency.
Audit
Dependencies
electronrequiredpeer dependency required to spawn/restart Electron process; must be installed separately