fix(cli): enable compile cache before importing the CLI - #2648
Conversation
|
Thanks for enabling the broader CI matrix. I investigated the failing Windows Socket Firewall job:
This points to the Windows/SFW execution path rather than the compile-cache change, but I cannot confirm the crash's cause locally on Linux. The Linux/macOS test jobs and the ecosystem E2E/project-creation matrices passed. Could a maintainer rerun the failed jobs to check reproducibility? I attempted the rerun, but GitHub requires repository admin rights. The fixture also currently skips its intended registry download because pnpm is bundled; that may warrant a separate CI fixture update. |
Registry bridge build (
|
| Package | Version |
|---|---|
vite-plus |
0.0.0-commit.b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf |
@voidzero-dev/vite-plus-core |
0.0.0-commit.b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf |
Install the Vite+ CLI built from this commit, then migrate a project:
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/pablog12/vite-plus/b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf/packages/cli/install.sh | VP_PR_VERSION=2648 bash# Windows (PowerShell)
$env:VP_PR_VERSION="2648"; irm https://raw.githubusercontent.com/pablog12/vite-plus/b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf/packages/cli/install.ps1 | iexOr 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.b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf" --registry "https://registry-bridge.viteplus.dev/"After installing, upgrade the current project's vite-plus to this test build with:
vp migrateOr 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.b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf",
"vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf"
}
}
fengmk2
left a comment
There was a problem hiding this comment.
@pablog12 Thanks, LGTM.
Since vpr has already fixed the compile cache issue in this way https://github.com/pablog12/vite-plus/blob/b2d868d8aa515ed1b4d592ebb22ecb90e3504fcf/packages/cli/bin/vpr#L10, I will delete the newly added test case packages/cli/src/tests/bootstrap-compile-cache.spec.ts before merge, as it should not be necessary.
Signed-off-by: MK (fengmk2) <fengmk2@gmail.com>
The npm
vpwrapper callsenableCompileCache(), but its static import loads and evaluates the CLI dependency graph before that call executes. Use an awaited dynamic import so the existing cache initialization happens first.The regression test runs the real wrapper in an isolated ESM fixture. It fails on the previous code (
getCompileCacheDir()is undefined during CLI module evaluation) and passes with this change. It also checks arguments containing spaces and preserves a nonzero exit code.This affects the npm wrapper; it does not claim to optimize the native/global entrypoint that bypasses it. Downstream warm-cache measurements on Linux/Node 24.19 showed approximately 36 ms less time for a full check and 42 ms for a three-file check; these are project-specific measurements, not a universal benchmark.
Validation on the submitted commit, using frozen pnpm 11.24.0 installations for the workspace and docs, the pinned Rolldown/Vite source revisions, and nightly-2026-08-02 Rust:
pnpm build: complete source build passed, including Rolldown, Vite/core, CLI JavaScript and the native CLI binding.tsgo --noEmit): passed after installing the separately documented docs dependencies.vp check packages/cli/src/__tests__/bootstrap-compile-cache.spec.ts: formatting, type-aware lint and type checks passed with the repository's configuration.node --check packages/cli/bin/vpand the built wrapper's--versioncommand: passed.The ordinary
pnpm test:unitinvocation initially had two environment-dependent failures: pnpm's shim injectedNODE_PATH, allowing a deliberately missing-dependency fixture to resolve an unrelated hoisted Vite; a hook test assumes/usr/bin/dirnameand an ordinary/bin/sh, whereas this NixOS host has no/usr/bin/dirnameand wraps/bin/shwith a modified PATH. All tests passed when invokingnode packages/cli/bin/vp test --run --maxWorkers=4withNODE_PATH,NO_COLORandFORCE_COLORcleared, inside a temporary Bubblewrap environment supplying standard coreutils and a plain Bash/bin/sh. No production code, test assertions, snapshots or host system paths were changed to accommodate these failures.The whole Rust workspace test suite, PTY/browser snapshot matrix and cross-platform CI matrix were not run locally.
After the repository's documented dependency setup, run the regression test with:
This is an isolated bootstrap unit test: the CLI module is a fixture, so it tests ESM initialization order without exercising command output or the native CLI.
AI assistance: implementation and self-review performed with OpenAI Codex using GPT-6 Astra (
gpt-6-astra), with reasoning effort set tohigh.