@@ -49,6 +49,11 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
49
49
const nodeTarget = getElectronNodeTarget ( )
50
50
51
51
const defaultConfig = {
52
+ resolve : {
53
+ browserField : false ,
54
+ mainFields : [ 'module' , 'jsnext:main' , 'jsnext' ] ,
55
+ conditions : [ 'node' ]
56
+ } ,
52
57
build : {
53
58
outDir : path . resolve ( root , 'out' , 'main' ) ,
54
59
target : nodeTarget ,
@@ -83,6 +88,8 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
83
88
const buildConfig = mergeConfig ( defaultConfig . build , build )
84
89
config . build = buildConfig
85
90
91
+ config . resolve = mergeConfig ( defaultConfig . resolve , config . resolve || { } )
92
+
86
93
config . define = config . define || { }
87
94
config . define = { ...processEnvDefine ( ) , ...config . define }
88
95
@@ -151,6 +158,11 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
151
158
const nodeTarget = getElectronNodeTarget ( )
152
159
153
160
const defaultConfig = {
161
+ resolve : {
162
+ browserField : false ,
163
+ mainFields : [ 'module' , 'jsnext:main' , 'jsnext' ] ,
164
+ conditions : [ 'node' ]
165
+ } ,
154
166
build : {
155
167
outDir : path . resolve ( root , 'out' , 'preload' ) ,
156
168
target : nodeTarget ,
@@ -185,6 +197,8 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
185
197
const buildConfig = mergeConfig ( defaultConfig . build , build )
186
198
config . build = buildConfig
187
199
200
+ config . resolve = mergeConfig ( defaultConfig . resolve , config . resolve || { } )
201
+
188
202
config . define = config . define || { }
189
203
config . define = { ...processEnvDefine ( ) , ...config . define }
190
204
0 commit comments