diff --git a/web/packages/next/global-electron.d.ts b/web/packages/next/global-electron.d.ts index a79cbc191..05a6838e1 100644 --- a/web/packages/next/global-electron.d.ts +++ b/web/packages/next/global-electron.d.ts @@ -14,5 +14,9 @@ declare global { * {@link Electron}) that allow us to communicate with the Node.js layer of * our desktop app. */ - const electron: Electron | undefined; + // This needs to be a var for it to be recognized as a property of + // globalThis, so we unfortunately need to hush eslint for the next line. + // + // eslint-disable-next-line no-var + var electron: Electron | undefined; } diff --git a/web/packages/next/log.ts b/web/packages/next/log.ts index 9d5818443..3dadbd288 100644 --- a/web/packages/next/log.ts +++ b/web/packages/next/log.ts @@ -1,6 +1,4 @@ import { inWorker } from "@/next/env"; -import isElectron from "is-electron"; -import ElectronAPIs from "./electron"; import { isDevBuild } from "./env"; import { logToDisk as webLogToDisk } from "./log-web"; import { workerBridge } from "./worker/worker-bridge"; @@ -12,7 +10,8 @@ import { workerBridge } from "./worker/worker-bridge"; * in the log that is saved on disk. */ export const logToDisk = (message: string) => { - if (isElectron()) ElectronAPIs.logToDisk(message); + const electron = globalThis.electron; + if (electron) electron.logToDisk(message); else if (inWorker()) workerLogToDisk(message); else webLogToDisk(message); };