Skip to content

fix(cli): run project-local vp dev in the launcher process - #3512

Merged
fengmk2 merged 1 commit into
mainfrom
codex/issue-3106-local-dev-signal
Nov 23, 2026
Merged

fengmk2 merged 1 commit into
mainfrom
codex/issue-3106-local-dev-signal

Conversation

@fengmk2

@fengmk2 fengmk2 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

On Unix, vp dev in a project starts Vite in a child process. A process manager can stop the launcher with SIGTERM while Vite keeps the port open.

The project-local launcher now runs Vite in its own process. The binding returns the dev command instead of starting it. The launcher applies the command's environment, working directory, and arguments, and then imports Vite's entry point. A signal to the launcher's process ID now reaches the dev server directly. Windows uses the same path.

Before and after

flowchart LR
  subgraph before["Before: two processes"]
    direction TB
    s1(["kill -TERM 100"]) --> l1["PID 100: launcher<br/>node bin/vp dev"]
    l1 -- "spawns and waits" --> v1["PID 101: Vite<br/>node vite.js dev"]
    l1 --> e1["The launcher exits"]
    v1 --> o1["Vite keeps running<br/>and holds the port"]
  end
  subgraph after["After: one process"]
    direction TB
    s2(["kill -TERM 100"]) --> p2["PID 100: launcher<br/>node bin/vp dev<br/>imports vite.js"]
    p2 --> e2["Vite closes the server<br/>and frees the port"]
  end
  classDef bad fill:#fde2e1,stroke:#c0392b,color:#000
  classDef good fill:#ddf4e4,stroke:#1e8449,color:#000
  class o1 bad
  class e2 good
Loading
Before After
Processes for project-local vp dev 2 1
SIGTERM to the launcher PID The launcher exits. Vite keeps running and holds the port. Vite closes the server. The process exits with code 143, as vite run directly does.
SIGKILL to the launcher PID Vite keeps running. The process ends.
--inspect-brk Only the launcher can be debugged. Vite gets no debugger session. One debugger session, and it covers Vite.
--cpu-prof The flag profiles only the launcher. In NODE_OPTIONS, it writes two profiles. One profile, and it includes Vite.
A preload in NODE_OPTIONS It loads in both processes, and its exit hook runs twice. It loads once, and its exit hook runs once.
A caller's IPC channel Vite has no channel. Vite can use the channel.
Global vp dev 3 processes 2 processes. A SIGTERM to the global vp PID still stops only vp.

Startup performance

Project-local vp dev Before After Change
Time until the server listens, empty compile cache 137 ms 109 ms −28 ms (−20%)
Time until the server listens, warm compile cache 120 ms 91 ms −29 ms (−24%)
Memory after startup (RSS) 168 MB 120 MB −48 MB (−29%)

The time and memory saved come from one less Node.js process, so the saving should stay about the same in a larger project.

In a Worker, the launcher keeps Vite as a child process, because a Worker cannot change the working directory.

Node.js restores the terminal mode itself on exit, SIGINT, and SIGTERM, as it does when Vite runs directly. The launcher no longer restores the terminal after SIGHUP, SIGKILL, or a signal that arrives after the last JavaScript listener is removed.

Closes #3106.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

CLI artifact sizes (ef3dbb4)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.
The dist rows use the Linux build. The core total excludes .node files to match the release artifact.

Artifact Format Base PR Change
packages/cli/dist Directory total 2.38 MiB 2.38 MiB +790 B (+0.03%)
packages/core/dist Directory total 4.11 MiB 4.11 MiB 0 B (0.00%)
Combined package dist Directory total 6.49 MiB 6.49 MiB +790 B (+0.01%)
vp (Linux x64) Binary 8.56 MiB 8.56 MiB 0 B (0.00%)
vp (Linux x64) gzip -9 3.92 MiB 3.92 MiB 0 B (0.00%)
NAPI (Linux x64) Binary 37.28 MiB 37.29 MiB +16.00 KiB (+0.04%)
NAPI (Linux x64) gzip -9 14.90 MiB 14.91 MiB +7.44 KiB (+0.05%)
vp (macOS ARM64) Binary 5.61 MiB 5.61 MiB 0 B (0.00%)
vp (macOS ARM64) gzip -9 3.34 MiB 3.34 MiB 0 B (0.00%)
NAPI (macOS ARM64) Binary 43.81 MiB 43.83 MiB +16.14 KiB (+0.04%)
NAPI (macOS ARM64) gzip -9 19.03 MiB 19.03 MiB +2.45 KiB (+0.01%)
vp (Windows x64) Binary 6.64 MiB 6.64 MiB 0 B (0.00%)
vp (Windows x64) gzip -9 3.03 MiB 3.03 MiB 0 B (0.00%)
NAPI (Windows x64) Binary 33.23 MiB 33.24 MiB +10.00 KiB (+0.03%)
NAPI (Windows x64) gzip -9 13.63 MiB 13.63 MiB +4.23 KiB (+0.03%)
Trampoline (Windows x64) Binary 13.50 KiB 13.50 KiB 0 B (0.00%)
Trampoline (Windows x64) gzip -9 7.09 KiB 7.09 KiB +1 B (+0.01%)
Installer (Windows x64) Binary 4.69 MiB 4.69 MiB 0 B (0.00%)
Installer (Windows x64) gzip -9 2.25 MiB 2.25 MiB -1 B (-0.00%)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://codex-issue-3106-local-dev-signal-viteplus-dev.voidzero-docs.workers.dev (commit ef3dbb4)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://748fc3fb-viteplus-dev.voidzero-docs.workers.dev ef3dbb4 2026-11-23T13:28:53.328Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://235a66a2-viteplus-dev.voidzero-docs.workers.dev b055d64 2026-11-23T12:35:11.952Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://59354d6b-viteplus-dev.voidzero-docs.workers.dev eef408b 2026-11-23T07:21:37.260Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://0f8c9199-viteplus-dev.voidzero-docs.workers.dev 947d9fb 2026-11-22T16:46:11.499Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://b890d866-viteplus-dev.voidzero-docs.workers.dev 1538e35 2026-11-22T14:31:31.264Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://5a5f8389-viteplus-dev.voidzero-docs.workers.dev 07c2b30 2026-11-22T13:21:01.492Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://d70e66c4-viteplus-dev.voidzero-docs.workers.dev 98c8f20 2026-11-21T14:59:42.663Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://6ed5913b-viteplus-dev.voidzero-docs.workers.dev e81aa68 2026-11-21T07:25:43.162Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://678174ce-viteplus-dev.voidzero-docs.workers.dev f316a6a 2026-11-21T04:55:47.170Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://b1f192d3-viteplus-dev.voidzero-docs.workers.dev 5a3104b 2026-11-20T20:40:32.515Z Visit the dashboard ↗

View all previews: View all previews ↗

@fengmk2
fengmk2 force-pushed the codex/issue-3106-local-dev-signal branch from be76f1d to af53571 Compare November 20, 2026 16:52
@fengmk2
fengmk2 marked this pull request as ready for review November 21, 2026 06:14
@fengmk2
fengmk2 added this pull request to stack #3522 November 21, 2026 06:14
@fengmk2
fengmk2 marked this pull request as draft November 21, 2026 06:15
@fengmk2
fengmk2 removed this pull request from stack #3522 November 21, 2026 07:25
@fengmk2
fengmk2 marked this pull request as ready for review November 22, 2026 11:08
@fengmk2 fengmk2 self-assigned this Nov 22, 2026
@fengmk2
fengmk2 requested a review from cpojer November 22, 2026 11:08
@fengmk2 fengmk2 changed the title fix(cli): stop project-local vp dev on SIGTERM fix(cli): run project-local vp dev in the launcher process Nov 22, 2026
@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests labels Nov 22, 2026
@fengmk2
fengmk2 force-pushed the codex/issue-3106-local-dev-signal branch from 07c2b30 to 1538e35 Compare November 22, 2026 14:30
@fengmk2 fengmk2 added the preview-build Publish this PR's commits to the registry bridge as preview builds label Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview binary sizes (947d9fb)

Compared with the latest stable release, v1.7.0. Preview build.
Each row measures one binary. Negative changes mean a smaller preview binary.

Binary Latest release Preview Change
vp (macOS ARM64) 5.46 MiB 5.61 MiB +162.05 KiB (+2.90%)
NAPI (macOS ARM64) 43.61 MiB 43.78 MiB +177.77 KiB (+0.40%)
vp (macOS x64) 6.93 MiB 7.10 MiB +172.79 KiB (+2.43%)
NAPI (macOS x64) 49.00 MiB 49.22 MiB +220.63 KiB (+0.44%)
vp (Linux ARM64 GNU) 6.91 MiB 7.10 MiB +188.07 KiB (+2.66%)
NAPI (Linux ARM64 GNU) 32.90 MiB 33.13 MiB +233.28 KiB (+0.69%)
vp (Linux ARM64 musl) 6.99 MiB 7.16 MiB +183.93 KiB (+2.57%)
NAPI (Linux ARM64 musl) 32.13 MiB 32.32 MiB +188.33 KiB (+0.57%)
vp (Linux x64 GNU) 8.35 MiB 8.55 MiB +204.07 KiB (+2.39%)
NAPI (Linux x64 GNU) 36.98 MiB 37.21 MiB +237.38 KiB (+0.63%)
vp (Linux x64 musl) 8.42 MiB 8.62 MiB +207.08 KiB (+2.40%)
NAPI (Linux x64 musl) 36.18 MiB 36.40 MiB +227.06 KiB (+0.61%)
vp (Windows x64) 6.19 MiB 6.64 MiB +461.00 KiB (+7.27%)
NAPI (Windows x64) 32.67 MiB 32.88 MiB +212.00 KiB (+0.63%)
Trampoline (Windows x64) 13.00 KiB 13.00 KiB 0 B (0.00%)
Installer (Windows x64) 4.69 MiB 4.69 MiB +1.00 KiB (+0.02%)
vp (Windows ARM64) 5.42 MiB 5.86 MiB +450.50 KiB (+8.12%)
NAPI (Windows ARM64) 28.85 MiB 29.00 MiB +155.50 KiB (+0.53%)
Trampoline (Windows ARM64) 13.00 KiB 13.00 KiB 0 B (0.00%)
Installer (Windows ARM64) 3.86 MiB 3.86 MiB +1.00 KiB (+0.03%)
gzip -9 sizes
Binary Latest release Preview Change
vp (macOS ARM64) 3.25 MiB 3.34 MiB +93.83 KiB (+2.82%)
NAPI (macOS ARM64) 18.93 MiB 19.02 MiB +94.88 KiB (+0.49%)
vp (macOS x64) 3.44 MiB 3.52 MiB +90.12 KiB (+2.56%)
NAPI (macOS x64) 20.22 MiB 20.32 MiB +101.11 KiB (+0.49%)
vp (Linux ARM64 GNU) 3.75 MiB 3.84 MiB +98.32 KiB (+2.56%)
NAPI (Linux ARM64 GNU) 14.02 MiB 14.12 MiB +108.00 KiB (+0.75%)
vp (Linux ARM64 musl) 3.77 MiB 3.87 MiB +102.07 KiB (+2.64%)
NAPI (Linux ARM64 musl) 13.72 MiB 13.82 MiB +102.21 KiB (+0.73%)
vp (Linux x64 GNU) 3.82 MiB 3.92 MiB +103.17 KiB (+2.64%)
NAPI (Linux x64 GNU) 14.75 MiB 14.86 MiB +110.10 KiB (+0.73%)
vp (Linux x64 musl) 3.84 MiB 3.94 MiB +103.30 KiB (+2.63%)
NAPI (Linux x64 musl) 14.43 MiB 14.53 MiB +101.76 KiB (+0.69%)
vp (Windows x64) 2.86 MiB 3.03 MiB +170.12 KiB (+5.80%)
NAPI (Windows x64) 13.39 MiB 13.49 MiB +106.38 KiB (+0.78%)
Trampoline (Windows x64) 7.14 KiB 7.14 KiB 0 B (0.00%)
Installer (Windows x64) 2.25 MiB 2.25 MiB +306 B (+0.01%)
vp (Windows ARM64) 2.73 MiB 2.90 MiB +166.92 KiB (+5.96%)
NAPI (Windows ARM64) 12.70 MiB 12.78 MiB +84.08 KiB (+0.65%)
Trampoline (Windows ARM64) 6.93 KiB 6.93 KiB 0 B (0.00%)
Installer (Windows ARM64) 2.14 MiB 2.14 MiB +43 B (+0.00%)

Raw sizes are uncompressed file sizes. gzip sizes recompress each binary at level 9; they are not package or download archive sizes.
The baseline uses published release files, including NAPI packages from npm at the same version. Build versions and toolchains can affect the difference.

@github-actions

Copy link
Copy Markdown
Contributor

Registry bridge build (947d9fb)

This commit build is published to the registry bridge, which serves these as ordinary npm versions (every other package proxies to npmjs):

Package Version
vite-plus 0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e
@voidzero-dev/vite-plus-core 0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e
create-vite-plus 0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e

Install the Vite+ CLI built from this commit, then migrate a project:

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/voidzero-dev/vite-plus/947d9fba2f87c28375f1efa5796833e3179b1b5e/packages/cli/install.sh | VP_PR_VERSION=3512 VP_LEGACY_INSTALLER_URL=https://raw.githubusercontent.com/voidzero-dev/vite-plus/947d9fba2f87c28375f1efa5796833e3179b1b5e/packages/cli/install-legacy.sh bash
# Windows (PowerShell)
$env:VP_PR_VERSION="3512"; $env:VP_LEGACY_INSTALLER_URL="https://raw.githubusercontent.com/voidzero-dev/vite-plus/947d9fba2f87c28375f1efa5796833e3179b1b5e/packages/cli/install-legacy.ps1"; irm https://raw.githubusercontent.com/voidzero-dev/vite-plus/947d9fba2f87c28375f1efa5796833e3179b1b5e/packages/cli/install.ps1 | iex

Or install with Homebrew (macOS / glibc Linux):

These commands use the formula and binary from this published commit. Replace brew install with brew reinstall if the tap package is already installed.
If Homebrew Core’s vite-plus is installed, run brew uninstall vite-plus first. This keeps your user data; do not run vp implode to switch installations.

(
  set -eu
  export HOMEBREW_NO_AUTO_UPDATE=1
  export HOMEBREW_VP_PR_VERSION=947d9fba2f87c28375f1efa5796833e3179b1b5e
  brew tap voidzero-dev/vite-plus https://github.com/voidzero-dev/vite-plus
  preview_tap="$(brew --repository voidzero-dev/vite-plus)"
  git -C "$preview_tap" fetch --depth=1 https://github.com/voidzero-dev/vite-plus.git "$HOMEBREW_VP_PR_VERSION"
  git -C "$preview_tap" switch --detach "$HOMEBREW_VP_PR_VERSION"
  brew install voidzero-dev/vite-plus/vp
  brew test voidzero-dev/vite-plus/vp
  "$(brew --prefix)/bin/vp"
)

The tap stays at the tested commit. Return it to main after testing:

git -C "$(brew --repository voidzero-dev/vite-plus)" switch main

Or download the standalone Windows installer built from this commit:

Architecture Installer
x64 vp-setup-x86_64-pc-windows-msvc.exe
Arm64 vp-setup-aarch64-pc-windows-msvc.exe

GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:

.\vp-setup.exe --version "0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e" --registry "https://registry-bridge.viteplus.dev/"

After installing, upgrade the current project's vite-plus to this test build with:

vp migrate

Or create a new project from this commit without installing the CLI:

export npm_config_registry=https://registry-bridge.viteplus.dev/ pnpm_config_registry=https://registry-bridge.viteplus.dev/
pnpm create vite-plus@0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e # or: npm create vite-plus@0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e
$env:npm_config_registry="https://registry-bridge.viteplus.dev/"; $env:pnpm_config_registry="https://registry-bridge.viteplus.dev/"
pnpm create vite-plus@0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e # or: npm create vite-plus@0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e

pnpm 11+ reads pnpm_config_registry, npm and older pnpm read npm_config_registry. The new project pins this build, so keep the registry set for later installs, or configure it as below.

Or point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:

Package manager Registry config
npm / pnpm / Bun .npmrc: registry=https://registry-bridge.viteplus.dev/
Yarn (v2+) .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/"

Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):

{
  "devDependencies": {
    "vite-plus": "0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e",
    "vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.947d9fba2f87c28375f1efa5796833e3179b1b5e"
  }
}

@github-actions

Copy link
Copy Markdown
Contributor

🐳 Docker preview image

Built from this PR's registry bridge build:

Image Compressed size
ghcr.io/voidzero-dev/vite-plus:pr-3512 229MB
# remove any stale local copy from a previous run, then pull fresh
docker rmi ghcr.io/voidzero-dev/vite-plus:pr-3512 2>/dev/null; docker pull ghcr.io/voidzero-dev/vite-plus:pr-3512

Quick check:

docker run --rm ghcr.io/voidzero-dev/vite-plus:pr-3512 vp --version

See docs/guide/docker.md for usage.

@fengmk2
fengmk2 force-pushed the codex/issue-3106-local-dev-signal branch 2 times, most recently from eef408b to b055d64 Compare November 23, 2026 12:34
On Unix, `vp dev` in a project started Vite in a child process. A
SIGTERM to the launcher's process ID stopped only the launcher, and
Vite kept the port open.

The binding now returns the dev command instead of starting it. The
launcher applies the command's environment and working directory,
rewrites `process.argv`, and imports Vite's entry point in its own
process. A signal to the launcher's process ID now reaches the dev
server. The launcher's Node.js options, preloads, and IPC channel apply
to Vite once, as when Vite runs directly. A Worker keeps Vite as a
child process, because a Worker cannot change the working directory.

Before Vite starts, the launcher sets stdout and stderr pipes back to
non-blocking, as Vite's own process did, so a slow reader cannot stall
the server.

Refs #3106.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fengmk2
fengmk2 force-pushed the codex/issue-3106-local-dev-signal branch from b055d64 to ef3dbb4 Compare November 23, 2026 13:27
@fengmk2
fengmk2 merged commit be9b8fd into main Nov 23, 2026
128 checks passed
@fengmk2
fengmk2 deleted the codex/issue-3106-local-dev-signal branch November 23, 2026 13:47
@fengmk2 fengmk2 mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-build Publish this PR's commits to the registry bridge as preview builds test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exec in place instead of spawning and waiting in the CLI's wrapper processes

2 participants