Reload Electron on HTML changes

If you want to reload an Electron window on HTML changes:

terminal
npm i electron-reload

Now add the package on the top of the Electron main.js:

javascript
// If you want to reload only on html changes
require('electron-reload')('index.html');

// You could also omit the index.html file
// require('electron-reload')();

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.