From 76f8f6ddec6b6d80dfc1cebbb88e4ff66e34a373 Mon Sep 17 00:00:00 2001 From: Jokul Date: Tue, 7 Jul 2026 21:40:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/updater.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/electron/main/updater.ts b/electron/main/updater.ts index 50ae6b5..10c5a47 100644 --- a/electron/main/updater.ts +++ b/electron/main/updater.ts @@ -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 () => {