fix: improve Node 16 compatibility for Win7 legacy build

This commit is contained in:
Memory 2026-03-27 22:10:46 +08:00 committed by GitHub
parent 7600f82c34
commit 3270e47a7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -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: {

View File

@ -28,7 +28,7 @@ export async function getProfileConfig(force = false): Promise<IProfileConfig> {
}
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<void> {
@ -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<IProfileItem | undefined> {