@@ -40,9 +40,9 @@ export function configure(api, inlineOptions) {
4040 let preOptions ;
4141
4242 /**
43- * @type {unknown }
43+ * @type {import('vite').DepOptimizationConfig | undefined }
4444 */
45- let extraViteConfig ;
45+ let optimizeDeps = undefined ;
4646
4747 /** @type {import('vite').Plugin } */
4848 return {
@@ -62,8 +62,9 @@ export function configure(api, inlineOptions) {
6262
6363 preOptions = await preResolveOptions ( inlineOptions , config , configEnv ) ;
6464 // extra vite config
65- extraViteConfig = await buildExtraViteConfig ( preOptions , config ) ;
65+ const extraViteConfig = await buildExtraViteConfig ( preOptions , config ) ;
6666 log . debug ( 'additional vite config' , extraViteConfig , 'config' ) ;
67+ optimizeDeps = extraViteConfig . optimizeDeps ;
6768 return extraViteConfig ;
6869 }
6970 } ,
@@ -93,10 +94,10 @@ export function configure(api, inlineOptions) {
9394 ensureConfigEnvironmentConditions ( name , config , opts ) ;
9495 // @ts -expect-error the function above should make `resolve.conditions` non-nullable
9596 config . resolve . conditions . push ( 'svelte' ) ;
96- if ( config . consumer === 'server' && extraViteConfig ?. optimizeDeps ) {
97+ if ( config . consumer === 'server' && optimizeDeps !== undefined ) {
9798 // optimizeDeps is not inherited by server environments so return it here
9899 return {
99- optimizeDeps : extraViteConfig . optimizeDeps
100+ optimizeDeps
100101 } ;
101102 }
102103 } ,
0 commit comments