perf: alway disable build.modulePreload in main and preload config

This commit is contained in:
alex8088 2023-03-25 13:21:33 +08:00
parent 103beec87b
commit 1cb7d419a2

View file

@ -91,6 +91,8 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
config.publicDir = config.publicDir || 'resources' config.publicDir = config.publicDir || 'resources'
// do not copy public dir // do not copy public dir
config.build.copyPublicDir = false config.build.copyPublicDir = false
// module preload polyfill does not apply to nodejs (main process)
config.build.modulePreload = false
} }
}, },
{ {
@ -191,6 +193,8 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
config.publicDir = config.publicDir || 'resources' config.publicDir = config.publicDir || 'resources'
// do not copy public dir // do not copy public dir
config.build.copyPublicDir = false config.build.copyPublicDir = false
// module preload polyfill does not apply to nodejs (preload scripts)
config.build.modulePreload = false
} }
}, },
{ {