npm i -D electron-reload
main.js:
const electron = require('electron')
require('electron-reload')(__dirname);
...rest of the code
const electron = require('electron')
// Enable live reload for all the files inside your project directory
require('electron-reload')(__dirname);