Electron hot reload

This commit is contained in:
Natsumi
2025-12-14 00:09:05 +11:00
parent 5c7b3a7cc7
commit 9d9805265a
2 changed files with 14 additions and 3 deletions

View File

@@ -56,6 +56,7 @@ const noInstall = args.includes('--no-install');
const x11 = args.includes('--x11');
const noDesktop = args.includes('--no-desktop');
const startup = args.includes('--startup');
const debug = args.includes('--hot-reload');
const noUpdater =
args.includes('--no-updater') ||
fs.existsSync(path.join(rootDir, '.no-updater'));
@@ -327,6 +328,10 @@ function createWindow() {
applyWindowState();
const indexPath = path.join(rootDir, 'build/html/index.html');
mainWindow.loadFile(indexPath);
if (debug) {
mainWindow.loadURL('http://localhost:9000/index.html');
mainWindow.webContents.openDevTools();
}
// add proxy config, doesn't work, thanks electron
// const proxy = VRCXStorage.Get('VRCX_Proxy');
@@ -436,7 +441,10 @@ function createWristOverlayWindowOffscreen() {
});
wristOverlayWindow.webContents.setFrameRate(2);
const indexPath = path.join(rootDir, 'build/html/vr.html');
let indexPath = path.join(rootDir, 'build/html/vr.html');
if (debug) {
indexPath = 'http://localhost:9000/vr.html';
}
const fileUrl = `file://${indexPath}?wrist`;
wristOverlayWindow.loadURL(fileUrl, { userAgent: version });
@@ -499,7 +507,10 @@ function createHmdOverlayWindowOffscreen() {
});
hmdOverlayWindow.webContents.setFrameRate(48);
const indexPath = path.join(rootDir, 'build/html/vr.html');
let indexPath = path.join(rootDir, 'build/html/vr.html');
if (debug) {
indexPath = 'http://localhost:9000/vr.html';
}
const fileUrl = `file://${indexPath}?hmd`;
hmdOverlayWindow.loadURL(fileUrl, { userAgent: version });