Fix NPE when opening DevTools

This commit is contained in:
Vendicated
2022-08-29 18:45:58 +02:00
parent 876e622f4f
commit 1709ab61ef
4 changed files with 17 additions and 7 deletions

View File

@ -20,6 +20,10 @@ class BrowserWindow extends electron.BrowserWindow {
}
}
Object.assign(BrowserWindow, electron.BrowserWindow);
// esbuild may rename our BrowserWindow, which leads to it being excluded
// from getFocusedWindow(), so this is necessary
// https://github.com/discord/electron/blob/13-x-y/lib/browser/api/browser-window.ts#L60-L62
Object.defineProperty(BrowserWindow, "name", { value: "BrowserWindow", configurable: true });
// Replace electrons exports with our custom BrowserWindow
const electronPath = require.resolve("electron");