fix: allow cache overlap in parallel builds #8592
Merged
+10
−14
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.
Description
We found out why the worker tests were failing after:
We now have deps caches during build that can't be used in parallel. @poyoho manually configured the worker (and assets) playground to have different caches (see c9b185c), so tests are now stable again.
We discussed that we need to implement something here because before building in parallel was possible. This PR implements a possible way forward, adding an id to the build deps cache based on the
outputDir
I think this may be enough. We can't use a general config hash, because it isn't easy to know when a dir could be removed. I don't think users would call vite build in parallel over the same outputDir, but we need to keep an eye to check if this is really enough.
The PR avoids the use of a hash if the dir name is small enough so it is easier to debug for the default
dist
or other dirs likeoutput
. The customcacheDir
s in the playground are no longer needed so they are removed (and this serves as a test for the PR)What is the purpose of this pull request?