electron-vite-react icon indicating copy to clipboard operation
electron-vite-react copied to clipboard

How to setup auto reload the app when the files of main process are updated?

Open MiniSuperDev opened this issue 9 months ago • 7 comments

For example I'm using IPC, but when change an implementation of a method of the IPC, this change is not showed in real time like when do a change in the renderer, currently I do manually restart to see the changes in the app.

Example: https://github.com/MiniSuperDev/electron-vite-react-main-reload/tree/main

  1. Click this button image
  2. Check the message image
  3. Change the implementation in the main process

Change this:

https://github.com/MiniSuperDev/electron-vite-react-main-reload/blob/main/electron/main/index.ts#L123-L128

For this:

ipcMain.handle("getDate", () => {
  return `Other String:` + `${Date.now()}`;
});
  1. Save and click the button again image

You notice that the message is the previous.

  1. Restart the app to see the new implementation image

I think it should restart the app, or do a hot reload if possible. Thanks

MiniSuperDev avatar Sep 26 '23 14:09 MiniSuperDev