@@ -40,9 +40,9 @@ export function configure(api, inlineOptions) {
40
40
let preOptions ;
41
41
42
42
/**
43
- * @type {unknown }
43
+ * @type {import('vite').DepOptimizationConfig | undefined }
44
44
*/
45
- let extraViteConfig ;
45
+ let optimizeDeps = undefined ;
46
46
47
47
/** @type {import('vite').Plugin } */
48
48
return {
@@ -62,8 +62,9 @@ export function configure(api, inlineOptions) {
62
62
63
63
preOptions = await preResolveOptions ( inlineOptions , config , configEnv ) ;
64
64
// extra vite config
65
- extraViteConfig = await buildExtraViteConfig ( preOptions , config ) ;
65
+ const extraViteConfig = await buildExtraViteConfig ( preOptions , config ) ;
66
66
log . debug ( 'additional vite config' , extraViteConfig , 'config' ) ;
67
+ optimizeDeps = extraViteConfig . optimizeDeps ;
67
68
return extraViteConfig ;
68
69
}
69
70
} ,
@@ -93,10 +94,10 @@ export function configure(api, inlineOptions) {
93
94
ensureConfigEnvironmentConditions ( name , config , opts ) ;
94
95
// @ts -expect-error the function above should make `resolve.conditions` non-nullable
95
96
config . resolve . conditions . push ( 'svelte' ) ;
96
- if ( config . consumer === 'server' && extraViteConfig ?. optimizeDeps ) {
97
+ if ( config . consumer === 'server' && optimizeDeps !== undefined ) {
97
98
// optimizeDeps is not inherited by server environments so return it here
98
99
return {
99
- optimizeDeps : extraViteConfig . optimizeDeps
100
+ optimizeDeps
100
101
} ;
101
102
}
102
103
} ,
0 commit comments