Electron – reload all BrowserWindows on code change
electron-reload is the simplest way to load contents of all active BrowserWindows within electron when the source files are changed.
To add electron-reload to your existing project, type
npm i electron-reload --save-dev
Initialize this module with desired glob or file path to watch and let it refresh electron browser windows as targets are changed
const electron = require('electron'); const path = require('path'); const url = require('url'); const { app, BrowserWindow } = electron; require('electron-reload')(__dirname); let win; app.on('ready', createWindow);
Here is a small video showing electron-reload in action.
You can download the source code for this article here.