Description
I followed the steps in this video to set up VitePlus in our monorepo (TresJS) and everything works great — builds, lint, etc. However, I can't get --cache to work for vp pack / vp build tasks.
Steps to reproduce
- Monorepo with multiple library packages, each with
"build": "vp pack" in package.json
- Run
vp run -r build --cache — first run completes, all tasks show cache miss (expected)
- Run
vp run -r build --cache again — 0% cache hit rate
What happens
Every task reports "Not cached: read and wrote ..." pointing to two types of files:
dist/ output files — e.g. packages/core/dist/tres.d.ts
.vite-temp/ config compilation artifacts — e.g. packages/core/node_modules/.vite-temp/vite.config.ts.timestamp-*.mjs
Since vp pack reads and writes to dist/, the auto file tracker sees the task modifying its own inputs, so cache can never hit.
[1] @tresjs/eslint-config#build: ~/packages/eslint-config$ vp pack ✓
→ Not cached: read and wrote 'packages/eslint-config/dist/index.cjs'
[2] @tresjs/core#build: ~/packages/core$ vp pack ✓
→ Not cached: read and wrote 'packages/core/node_modules/.vite-temp/vite.config.ts.timestamp-*.mjs'
Workaround found
We got cache working by:
- Moving the
build script from package.json to run.tasks in vite.config.ts with input exclusions:
export default defineConfig({
run: {
tasks: {
build: {
command: 'vp pack',
input: [{ auto: true }, '!dist/**', '!**/node_modules/.vite-temp/**'],
},
},
},
})
- Removing the
"build" script from package.json (VitePlus errors if both exist with the same name)
After this, cache hits work on subsequent runs.
Question
Is this the expected setup? It feels like vp pack and vp build should either:
- Automatically exclude their own output directories (
dist/) from cache input tracking
- Or exclude
.vite-temp/ compilation artifacts by default
Since these are VitePlus's own commands, it seems like the cache should work out of the box without needing manual input exclusions. Maybe we're missing a configuration step?
Environment
- vite-plus: 0.1.14
- Node: v22
- pnpm: 10.20.0
- macOS Darwin 25.3.0
Description
I followed the steps in this video to set up VitePlus in our monorepo (TresJS) and everything works great — builds, lint, etc. However, I can't get
--cacheto work forvp pack/vp buildtasks.Steps to reproduce
"build": "vp pack"inpackage.jsonvp run -r build --cache— first run completes, all tasks showcache miss(expected)vp run -r build --cacheagain — 0% cache hit rateWhat happens
Every task reports "Not cached: read and wrote ..." pointing to two types of files:
dist/output files — e.g.packages/core/dist/tres.d.ts.vite-temp/config compilation artifacts — e.g.packages/core/node_modules/.vite-temp/vite.config.ts.timestamp-*.mjsSince
vp packreads and writes todist/, the auto file tracker sees the task modifying its own inputs, so cache can never hit.Workaround found
We got cache working by:
buildscript frompackage.jsontorun.tasksinvite.config.tswith input exclusions:"build"script frompackage.json(VitePlus errors if both exist with the same name)After this, cache hits work on subsequent runs.
Question
Is this the expected setup? It feels like
vp packandvp buildshould either:dist/) from cache input tracking.vite-temp/compilation artifacts by defaultSince these are VitePlus's own commands, it seems like the cache should work out of the box without needing manual
inputexclusions. Maybe we're missing a configuration step?Environment