perf: ignore browser
field and additional node
condition for main config
This commit is contained in:
parent
3def0ed84b
commit
4f796e4c8a
|
@ -49,6 +49,11 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
|
||||||
const nodeTarget = getElectronNodeTarget()
|
const nodeTarget = getElectronNodeTarget()
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
|
resolve: {
|
||||||
|
browserField: false,
|
||||||
|
mainFields: ['module', 'jsnext:main', 'jsnext'],
|
||||||
|
conditions: ['node']
|
||||||
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: path.resolve(root, 'out', 'main'),
|
outDir: path.resolve(root, 'out', 'main'),
|
||||||
target: nodeTarget,
|
target: nodeTarget,
|
||||||
|
@ -83,6 +88,8 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
|
||||||
const buildConfig = mergeConfig(defaultConfig.build, build)
|
const buildConfig = mergeConfig(defaultConfig.build, build)
|
||||||
config.build = buildConfig
|
config.build = buildConfig
|
||||||
|
|
||||||
|
config.resolve = mergeConfig(defaultConfig.resolve, config.resolve || {})
|
||||||
|
|
||||||
config.define = config.define || {}
|
config.define = config.define || {}
|
||||||
config.define = { ...processEnvDefine(), ...config.define }
|
config.define = { ...processEnvDefine(), ...config.define }
|
||||||
|
|
||||||
|
@ -151,6 +158,11 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
||||||
const nodeTarget = getElectronNodeTarget()
|
const nodeTarget = getElectronNodeTarget()
|
||||||
|
|
||||||
const defaultConfig = {
|
const defaultConfig = {
|
||||||
|
resolve: {
|
||||||
|
browserField: false,
|
||||||
|
mainFields: ['module', 'jsnext:main', 'jsnext'],
|
||||||
|
conditions: ['node']
|
||||||
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: path.resolve(root, 'out', 'preload'),
|
outDir: path.resolve(root, 'out', 'preload'),
|
||||||
target: nodeTarget,
|
target: nodeTarget,
|
||||||
|
@ -185,6 +197,8 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
||||||
const buildConfig = mergeConfig(defaultConfig.build, build)
|
const buildConfig = mergeConfig(defaultConfig.build, build)
|
||||||
config.build = buildConfig
|
config.build = buildConfig
|
||||||
|
|
||||||
|
config.resolve = mergeConfig(defaultConfig.resolve, config.resolve || {})
|
||||||
|
|
||||||
config.define = config.define || {}
|
config.define = config.define || {}
|
||||||
config.define = { ...processEnvDefine(), ...config.define }
|
config.define = { ...processEnvDefine(), ...config.define }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue