From 3270e47a7b65d137ac98a6a554688643eb72a493 Mon Sep 17 00:00:00 2001 From: Memory <134070804+Memory2314@users.noreply.github.com> Date: Fri, 27 Mar 2026 22:10:46 +0800 Subject: [PATCH] fix: improve Node 16 compatibility for Win7 legacy build --- electron.vite.config.ts | 2 +- src/main/config/profile.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/electron.vite.config.ts b/electron.vite.config.ts index 71b03fd..b23b4da 100644 --- a/electron.vite.config.ts +++ b/electron.vite.config.ts @@ -17,7 +17,7 @@ const monacoEditorPlugin = isObjectWithDefaultFunction(monacoEditorPluginModule) // Win7 build: bundle all deps (Vite converts ESM→CJS), only externalize native modules const isLegacyBuild = process.env.LEGACY_BUILD === 'true' -const legacyExternal = ['sysproxy-rs', 'electron'] +const legacyExternal = ['sysproxy-rs', 'electron', 'utf-8-validate', 'bufferutil'] export default defineConfig({ main: { diff --git a/src/main/config/profile.ts b/src/main/config/profile.ts index 5761359..fd91204 100644 --- a/src/main/config/profile.ts +++ b/src/main/config/profile.ts @@ -28,7 +28,7 @@ export async function getProfileConfig(force = false): Promise { } if (typeof profileConfig !== 'object') profileConfig = { items: [] } if (!Array.isArray(profileConfig.items)) profileConfig.items = [] - return structuredClone(profileConfig) + return JSON.parse(JSON.stringify(profileConfig)) } export async function setProfileConfig(config: IProfileConfig): Promise { @@ -48,12 +48,12 @@ export async function updateProfileConfig( profileConfig = parse(data) || { items: [] } if (typeof profileConfig !== 'object') profileConfig = { items: [] } if (!Array.isArray(profileConfig.items)) profileConfig.items = [] - profileConfig = await updater(structuredClone(profileConfig)) + profileConfig = await updater(JSON.parse(JSON.stringify(profileConfig))) result = profileConfig await writeFile(profileConfigPath(), stringify(profileConfig), 'utf-8') }) await profileConfigWriteQueue - return structuredClone(result ?? profileConfig) + return JSON.parse(JSON.stringify(result ?? profileConfig)) } export async function getProfileItem(id: string | undefined): Promise {