Open Pistonight opened 1 day ago
I did notice that the deprecated cache.dir
option behave correctly.
Seems like it's not checking vite cacheDir here but it should?
Seems like it's not checking vite cacheDir here but it should?
Looks like a bug indeed. PR is welcome!
Thanks for confirming, just to clarify my understanding: how do these 3 properties relate and resolve exactly?
cacheDir
server.deps.cacheDir
cache.dir
As par the change https://github.com/vitest-dev/vitest/pull/5229, the intent is to put things under cacheDir + '/vitest'
. Vitest users don't need to configure server.deps.cacheDir
and the others should mostly look like:
const finalCacheDir = cache.dir ?? join(cacheDir, "vitest")
// ^^^^^^^^
// this is probably hard-coded as `node_modules/.vite`,
// which is a bug
By default Vite has cacheDir = 'node_modules/.vite'
, so Vitest uses node_modules/.vite/vitest
. If you explicitly set cacheDir = '.vite'
, Vitest should probably use .vite/vitest
.
Describe the bug
cacheDir
not honored ifdeps.optimizer.{mode}.enabled
is true. vitest will save cache tonode_modules/.vite
as ifcacheDir
is not specified.Reproduction
Run
Edit the config
Create a test
src/App.test.tsx
Run
node_modules/.vite
.test.deps.optimizer.ssr.enabled
tofalse
, and runnpx vitest
again.vite
as expectedSystem Info
Used Package Manager
npm
Validations