fix(start): launch Vite in foreground API mode when WithWeb is set

Start the web dev server for -WithWeb even without -Background so 5173 is available in the common foreground run path.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-06 17:26:26 +08:00
parent dbe3062d1b
commit d529ff70ff

View file

@ -96,6 +96,23 @@ if ($Background) {
exit 0
}
if ($WithWeb) {
Write-Host "==> Starting Vite dev server in background (foreground API mode)"
$webRoot = Join-Path $projectRoot "web"
$webProc = Start-Process -FilePath "npm.cmd" `
-ArgumentList @("run", "dev", "--", "--host", $BindHost, "--port", "$WebPort") `
-WorkingDirectory $webRoot `
-WindowStyle Hidden `
-RedirectStandardOutput $webLogFile `
-RedirectStandardError $webErrFile `
-PassThru
Set-Content -Path $webPidFile -Value "$($webProc.Id)"
Write-Host "web.pid = $webPidFile"
Write-Host "PID = $($webProc.Id)"
Write-Host "Log = $webLogFile"
Write-Host "Err = $webErrFile"
}
Write-Host "==> Starting netx in foreground"
& $pythonExe -m netx_api.main