mirror of
https://github.com/alex8088/electron-vite.git
synced 2025-05-22 12:59:15 +08:00
feat: resolve conditions for preload
This commit is contained in:
parent
4b47ef0bd4
commit
6e8572d9b7
@ -198,6 +198,12 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
|||||||
const format = pkg.type && pkg.type === 'module' && supportESM() ? 'es' : 'cjs'
|
const format = pkg.type && pkg.type === 'module' && supportESM() ? 'es' : 'cjs'
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
|
ssr: {
|
||||||
|
resolve: {
|
||||||
|
conditions: ['module', 'browser', 'development|production'],
|
||||||
|
mainFields: ['browser', 'module', 'jsnext:main', 'jsnext']
|
||||||
|
}
|
||||||
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: path.resolve(root, 'out', 'preload'),
|
outDir: path.resolve(root, 'out', 'preload'),
|
||||||
target: nodeTarget,
|
target: nodeTarget,
|
||||||
@ -272,7 +278,8 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
|||||||
// enable ssr build
|
// enable ssr build
|
||||||
config.build.ssr = true
|
config.build.ssr = true
|
||||||
config.build.ssrEmitAssets = true
|
config.build.ssrEmitAssets = true
|
||||||
config.ssr = { ...config.ssr, ...{ noExternal: true } }
|
config.ssr = mergeConfig(defaultConfig.ssr, config.ssr || {})
|
||||||
|
config.ssr.noExternal = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user