Repository navigation
Conversation
The build lock treated a client build and an SSR build of the same project as duplicates, so running them in parallel failed with "Found another Vite build process". Store the resolved outDir for builds and only treat builds into the same directory as duplicates.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This lets client and SSR builds run at the same time again when they write to different output directories. Builds targeting the same directory still use the existing lock protection.
The bug
The command lock added in 8.4.0 (#23624) treats a client build and an SSR build of the same app as duplicates. It checks the command, project root, config file, and mode, but not where the build writes its output.
That breaks a setup like this, even though the two builds write to separate folders:
{ "scripts": { "build:client": "vite build --outDir dist/client", "build:server": "vite build --ssr src/entry-server.js --outDir dist/server", "build": "run-p build:client build:server" } }One of the builds exits with:
Running client and server builds together is a common SSR setup, whether through
run-p,concurrently, or turbo. On a fresh React SSR app, 8 of 10 runs failed with 8.4.0. The same setup passed all 10 runs with 8.3.8.The failure depends on timing. Both processes can check for a lock before either writes one, so some runs still pass. That makes the problem harder to pin down in CI.
--bypass-lockworks around it, but this setup didn't need a bypass before 8.4.0.The fix
Build lock records now include the resolved
build.outDir. The existing checks still apply, but builds with different output directories no longer count as duplicates. The client and SSR builds above can run together without a bypass flag.Builds targeting the same output directory are still blocked, since they could overwrite each other's files. Dev and preview locks are unchanged.
Older lock files from 8.4.0 don't have an
outDir. Those still count as a match when the existing fields match, keeping the previous behavior for those records.Tests
Added three tests in
commandLock.spec.tsto check that the build record stores the resolvedoutDir, a build targeting a different directory is allowed, and a build targeting the same directory is blocked. Two of these tests fail without the fix and pass with it.All 15 lock tests and 1,254 node unit tests pass.
tsc,oxlint, andoxfmtare clean.Manual checks with the built package on the same React SSR app passed all 10 parallel runs, and the SSR output renders. Two identical
vite buildcommands running in parallel were still blocked in all 5 checks.AI disclosure: I used Claude (an AI coding assistant) to help find the bug and write the fix and tests. The reproduction and checks above were run against the real npm packages and the built package.