mirror of
https://github.com/alex8088/electron-vite.git
synced 2026-04-29 17:28:15 +08:00
fix: externalize electron via ssr.external for Vite 8
In Vite 8, rollupOptions.external is not honored when rolldownOptions exists separately. Use ssr.external to ensure electron is externalized in both main and preload SSR builds, since ssr.external takes precedence over ssr.noExternal for specified packages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8660e7ac5e
commit
62956e3894
@ -122,7 +122,7 @@ export function electronMainConfigPresetPlugin(options?: ElectronPluginOptions):
|
||||
// enable ssr build
|
||||
config.build.ssr = true
|
||||
config.build.ssrEmitAssets = true
|
||||
config.ssr = { ...config.ssr, ...{ noExternal: true } }
|
||||
config.ssr = { ...config.ssr, noExternal: true, external: ['electron'] }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -272,6 +272,7 @@ export function electronPreloadConfigPresetPlugin(options?: ElectronPluginOption
|
||||
config.build.ssrEmitAssets = true
|
||||
config.ssr = mergeConfig(defaultConfig.ssr, config.ssr || {})
|
||||
config.ssr.noExternal = true
|
||||
config.ssr.external = ['electron']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user