Skip to content

Commit e414514

Browse files
wynxingclaude
andcommitted
fix: Electron 构建顺序与 portable 自动更新问题
- 调整 build:electron 脚本顺序:先 vite build 生成 dist 产物,再编译网关, 保证 webembed 嵌入的是最新前端资源 - 在 setupAutoUpdater() 中检测 PORTABLE_EXECUTABLE_DIR,portable 模式下 跳过自动更新检查,避免 NSIS 不支持的更新流程误导用户 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1facbd8 commit e414514

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

web/electron/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,12 @@ function setupAutoUpdater(): void {
363363
return
364364
}
365365

366+
const isPortable = !!process.env.PORTABLE_EXECUTABLE_DIR
367+
if (isPortable) {
368+
console.log('[Updater] Skipped in portable mode')
369+
return
370+
}
371+
366372
autoUpdater.logger = console
367373
autoUpdater.autoDownload = true
368374
autoUpdater.autoInstallOnAppQuit = false

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dev": "vite",
1111
"dev:electron": "node scripts/clean-electron.js && node scripts/build-gateway.js && vite --mode electron",
1212
"build": "tsc -b && vite build",
13-
"build:electron": "node scripts/clean-electron.js && node scripts/build-gateway.js && vite build --mode electron && node scripts/verify-electron-preload.js && electron-builder --config electron-builder.config.cjs",
13+
"build:electron": "node scripts/clean-electron.js && vite build --mode electron && node scripts/build-gateway.js && node scripts/verify-electron-preload.js && electron-builder --config electron-builder.config.cjs",
1414
"preview": "vite preview",
1515
"test": "vitest run",
1616
"test:ui": "vitest --ui",

0 commit comments

Comments
 (0)