Remove electron-reload

It reloads the BrowserWindow, but that already has HMR since we're connecting to
a Next dev server on localhost.

What we want is the main process to reload if the files for the main process are
changed. All options I've found so far just restart the main app on changes to
the main process code. I'm not sure that'll be useful, so not adding them right
now (and in any case, this is not a regression, it just wasn't working with
electron-reload either). For future reference if I need to revisit this, these
are the things I scouted:

- https://www.electronforge.io/config/plugins/webpack
- https://github.com/sindresorhus/electron-reloader
- https://electron-vite.org/guide/hot-reloading.html
This commit is contained in:
Manav Rathi 2024-03-22 15:55:25 +05:30
parent f2c288bdab
commit f083f0633d
No known key found for this signature in database
4 changed files with 1 additions and 31 deletions

View file

@ -42,13 +42,6 @@ This spins up a server for serving files using a protocol handler inside our
Electron process. This allows us to directly use the output produced by
`next build` for loading into our renderer process.
### electron-reload
Reloads contents of the BrowserWindow (renderer process) when source files are
changed.
* TODO (MR): Do we need this? Isn't the next-electron-server HMR covering this?
## DX
See [web/docs/dependencies#DX](../../web/docs/dependencies.md#dx) for the

View file

@ -25,7 +25,6 @@
"chokidar": "^3.5.3",
"compare-versions": "^6.1.0",
"electron-log": "^4.3.5",
"electron-reload": "^2.0.0-alpha.1",
"electron-store": "^8.0.1",
"electron-updater": "^4.3.8",
"ffmpeg-static": "^5.1.0",

View file

@ -1,5 +1,4 @@
import { app, BrowserWindow } from "electron";
import electronReload from "electron-reload";
import serveNextAt from "next-electron-server";
import { initWatcher } from "./services/chokidar";
import { isDev } from "./utils/common";
@ -42,19 +41,6 @@ export const setIsUpdateAvailable = (value: boolean): void => {
updateIsAvailable = value;
};
/**
* Hot reload the main process if anything changes in the source directory that
* we're running from.
*
* In particular, this gets triggered when the `tsc -w` rebuilds JS files in the
* `app/` directory when we change the TS files in the `src/` directory.
*/
const setupMainHotReload = () => {
if (isDev) {
electronReload(__dirname, {});
}
};
/**
* The URL where the renderer HTML is being served from.
*/
@ -77,7 +63,6 @@ const setupRendererServer = () => {
serveNextAt(rendererURL);
};
setupMainHotReload();
setupRendererServer();
setupLogging(isDev);

View file

@ -789,7 +789,7 @@ chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.2:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
chokidar@^3.5.2, chokidar@^3.5.3:
chokidar@^3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
@ -1162,13 +1162,6 @@ electron-publish@24.5.0:
lazy-val "^1.0.5"
mime "^2.5.2"
electron-reload@^2.0.0-alpha.1:
version "2.0.0-alpha.1"
resolved "https://registry.yarnpkg.com/electron-reload/-/electron-reload-2.0.0-alpha.1.tgz#6cad98df96695ca1d5462dc9407f7c620028ce99"
integrity sha512-hTde7gv0TEqxbxlB3pj2CwoyCQ9sdiQrcP8GkpzhosxyVeYM3mZbMEVKCZK3L0fED7Mz5A9IWmK7zEvi4H3P1g==
dependencies:
chokidar "^3.5.2"
electron-store@^8.0.1:
version "8.0.2"
resolved "https://registry.yarnpkg.com/electron-store/-/electron-store-8.0.2.tgz#95c8cf81c1e1cf48b24f3ceeea24b921c1ff62d7"