You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a regression caused by the changes introduced by #4036 - I have a Yarn PnP monorepo setup that provides dependencies used both in my component/test code and optimized dependency code. I'm using React and Ariakit in the linked reproduction, but this issue is a bit more critical in my private setup where I have both a dependency that is sensitive to duplicate instances and another dependent that requires transpilation by Vite's dependency optimizer.
I'm not sure if the changes in #4036 were completely necessary, as prior to Vitest 0.34.4, I was already seeing Vitest isolate the optimized dependency cache across workspaces. For example, on Vitest 0.34.3, I have two projects that would each optimize the dependency under two separate caches in the respective node_modules folders:
Regardless, amending the code to store project caches relative to the workspace root rather than the project root would alleviate my issue. The regression boils down to the fact that resolveOptimizerConfig previously resolved a relative path node_modules/.vitest as the cacheDir, but after the changes to this function, it now resolves to an absolute path via VitestCache.resolveCacheDir. I think the most obvious fix would be to provide a default value for the root argument that resolves to the folder containing the workspace vitest.config.js file instead of process.cwd().
Describe the bug
I found a regression caused by the changes introduced by #4036 - I have a Yarn PnP monorepo setup that provides dependencies used both in my component/test code and optimized dependency code. I'm using React and Ariakit in the linked reproduction, but this issue is a bit more critical in my private setup where I have both a dependency that is sensitive to duplicate instances and another dependent that requires transpilation by Vite's dependency optimizer.
I'm not sure if the changes in #4036 were completely necessary, as prior to Vitest 0.34.4, I was already seeing Vitest isolate the optimized dependency cache across workspaces. For example, on Vitest 0.34.3, I have two projects that would each optimize the dependency under two separate caches in the respective
node_modules
folders:site-a/node_modules/.vitest/deps/@kherock_example.js
site-b/node_modules/.vitest/deps/@kherock_example.js
Regardless, amending the code to store project caches relative to the workspace root rather than the project root would alleviate my issue. The regression boils down to the fact that
resolveOptimizerConfig
previously resolved a relative pathnode_modules/.vitest
as thecacheDir
, but after the changes to this function, it now resolves to an absolute path viaVitestCache.resolveCacheDir
. I think the most obvious fix would be to provide a default value for theroot
argument that resolves to the folder containing the workspacevitest.config.js
file instead ofprocess.cwd()
.Reproduction
https://github.com/kherock/vitest-workspace-deps-repro
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: