@@ -620,37 +620,25 @@ impl UserConfigLoader for VitePlusConfigLoader {
620620 ) -> anyhow:: Result < Option < UserRunConfig > > {
621621 // Try static config extraction first (no JS runtime needed)
622622 let static_fields = vite_static_config:: resolve_static_config ( package_path) ;
623-
624- // If plugins are present, a plugin's config hook may add/modify the `run`
625- // field at runtime, so we must fall back to NAPI-based resolution which
626- // calls Vite's resolveConfig() and executes plugin hooks.
627- if static_fields. get ( "plugins" ) . is_some ( ) {
628- tracing:: debug!(
629- "plugins detected for {}, falling back to NAPI to run config hooks" ,
630- package_path. as_path( ) . display( )
631- ) ;
632- } else {
633- // No plugins — static analysis results are trustworthy
634- match static_fields. get ( "run" ) {
635- Some ( vite_static_config:: FieldValue :: Json ( run_value) ) => {
636- tracing:: debug!(
637- "Using statically extracted run config for {}" ,
638- package_path. as_path( ) . display( )
639- ) ;
640- let run_config: UserRunConfig = serde_json:: from_value ( run_value) ?;
641- return Ok ( Some ( run_config) ) ;
642- }
643- Some ( vite_static_config:: FieldValue :: NonStatic ) => {
644- // `run` field exists (or may exist via a spread) — fall back to NAPI
645- tracing:: debug!(
646- "run config is not statically analyzable for {}, falling back to NAPI" ,
647- package_path. as_path( ) . display( )
648- ) ;
649- }
650- None => {
651- // Config was analyzed successfully and `run` field is definitively absent
652- return Ok ( None ) ;
653- }
623+ match static_fields. get ( "run" ) {
624+ Some ( vite_static_config:: FieldValue :: Json ( run_value) ) => {
625+ tracing:: debug!(
626+ "Using statically extracted run config for {}" ,
627+ package_path. as_path( ) . display( )
628+ ) ;
629+ let run_config: UserRunConfig = serde_json:: from_value ( run_value) ?;
630+ return Ok ( Some ( run_config) ) ;
631+ }
632+ Some ( vite_static_config:: FieldValue :: NonStatic ) => {
633+ // `run` field exists (or may exist via a spread) — fall back to NAPI
634+ tracing:: debug!(
635+ "run config is not statically analyzable for {}, falling back to NAPI" ,
636+ package_path. as_path( ) . display( )
637+ ) ;
638+ }
639+ None => {
640+ // Config was analyzed successfully and `run` field is definitively absent
641+ return Ok ( None ) ;
654642 }
655643 }
656644
0 commit comments