File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
crates/vite_task/src/config Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use std::{
77 collections:: { BTreeMap , BTreeSet } ,
88 ffi:: OsStr ,
99 future:: Future ,
10+ iter:: once,
1011 sync:: Arc ,
1112} ;
1213
@@ -170,10 +171,21 @@ impl ResolvedTask {
170171 fingerprint_ignores : Option < Vec < Str > > ,
171172 ) -> Result < Self , Error > {
172173 let ResolveCommandResult { bin_path, envs } = command_result;
174+ #[ cfg( unix) ]
175+ let is_node_command = bin_path. contains ( '/' ) ;
176+ #[ cfg( windows) ]
177+ let is_node_command = bin_path. contains ( '\\' ) ;
178+
179+ let args_str = args. clone ( ) . map ( |arg| arg. as_ref ( ) . into ( ) ) ;
180+
173181 let builtin_task = TaskCommand :: Parsed ( TaskParsedCommand {
174- args : args. clone ( ) . map ( |arg| arg. as_ref ( ) . into ( ) ) . collect ( ) ,
182+ args : if is_node_command {
183+ once ( bin_path. as_str ( ) . into ( ) ) . chain ( args_str) . collect ( )
184+ } else {
185+ args_str. collect ( )
186+ } ,
175187 envs : envs. into_iter ( ) . map ( |( k, v) | ( k. into ( ) , v. into ( ) ) ) . collect ( ) ,
176- program : bin_path. into ( ) ,
188+ program : if is_node_command { "node" . into ( ) } else { bin_path. into ( ) } ,
177189 } ) ;
178190 let mut task_config: TaskConfig = builtin_task. clone ( ) . into ( ) ;
179191 task_config. set_fingerprint_ignores ( fingerprint_ignores. clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments