While you’re developing an Electron-based application, it’s nice to be able to make changes without having to manually stop and restart your application. To aid in that, someone created an NPM package named electron-reload, which integrates easily with your application, requiring minimal changes, and giving you live-reload functionality.
Simply install the package as a development-only dependency in your package.json file:
npm install --save-dev electron-reload
In your main.js (or whatever you named your entry point), simply add the following line:
The next time you launch your application, you should see changes happen when you save files to your project directory! No more stopping and relaunching your application whenever you make changes and want to test them!
When I ran my Electron application, I received an odd error message, which wasn’t fully clear to me. However, live reloading seemed to continue to work just fine.
“Electron could not be found. No hard resets for you!“