Commit dadc841
authored
fix(vite_task): pass raw args to dev command (#198)
### TL;DR
Fix argument handling for the `vite dev` command and improve debugging information.
### What changed?
- Fixed argument handling for the `vite dev` command by replacing `#[clap(last = true)]` with `#[arg(allow_hyphen_values = true, trailing_var_arg = true)]` to properly support hyphenated arguments
- Removed an unnecessary debug log in `TaskEnvs`
- Added detailed debug logging for executed commands, including duration and exit status
- Added a new snapshot test to verify that the `vite dev` command correctly handles port arguments
### How to test?
Run the new snapshot test to verify that the `vite dev` command correctly handles the `--port` argument:
```bash
cd packages/cli/snap-tests/command-dev-with-port
vite dev --port 12312312312
```
The command should properly pass the port argument to the dev server and show the expected RangeError.
### Why make this change?
The previous implementation didn't properly handle hyphenated arguments for the `vite dev` command, which could cause issues when users tried to pass options like `--port`. This change ensures that all arguments, including those with hyphens, are correctly passed to the underlying Vite process. The additional logging also helps with debugging task execution.1 parent 73cab43 commit dadc841
6 files changed
Lines changed: 20 additions & 3 deletions
File tree
- crates/vite_task/src
- packages/cli/snap-tests/command-dev-with-port
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
315 | | - | |
316 | 314 | | |
317 | 315 | | |
318 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
226 | 233 | | |
227 | 234 | | |
228 | 235 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments