This commit is contained in:
2026-07-07 21:40:36 +08:00
parent cdadfbe5e4
commit 76f8f6ddec
+6 -3
View File
@@ -1,12 +1,15 @@
// electron/main/updater.ts
// 自动更新模块
import { autoUpdater } from 'electron-updater'
// electron-updater is CommonJS with a lazy getter for `autoUpdater`, so a named
// ESM import fails at runtime under Node ESM (cjs-module-lexer can't detect it).
// Use the default interop import and access the instance lazily inside initUpdater
// (after app.whenReady), matching the original intended evaluation timing.
import electronUpdater from 'electron-updater'
import { BrowserWindow, ipcMain } from 'electron'
let mainWindow: BrowserWindow | null = null
export function initUpdater(win: BrowserWindow): void {
mainWindow = win
const autoUpdater = electronUpdater.autoUpdater
// 检查更新
ipcMain.handle('updater:check', async () => {