Reproduction
Repository: https://github.com/hardfist/rspack-persistent-cache-missing-build-deps-recovery-repro
This is a JavaScript repro using the public compiler API and the published @rspack/core@2.1.4 package:
The repro uses a loader that reads an external flag.txt file. That file is explicitly listed in cache.buildDependencies, so changing it should invalidate the persistent cache.
Steps:
- Build with
flag.txt = A.
- Remove all records from the
snapshot_build scope and recompute its pack integrity hash.
- Change
flag.txt to B and start a fresh process against the cache.
- Compare with a cold build.
Observed on @rspack/core@2.1.4:
recovered exit: 0
recovered output contains A: true
recovered output contains B: false
cold build has errors: false
cold output contains B: true
BUG REPRODUCED: missing build-dependency recovery keeps stale output.
The recovered build succeeds but silently emits the old result even though the explicitly configured build dependency changed.
Expected behavior
An absent/incomplete snapshot_build scope should invalidate the cache or conservatively rerun build-dependency validation. A changed file listed in cache.buildDependencies must not be ignored during persistent-cache recovery.
Environment
@rspack/core@2.1.4
- Node.js 24
- macOS arm64
Reproduction
Repository: https://github.com/hardfist/rspack-persistent-cache-missing-build-deps-recovery-repro
This is a JavaScript repro using the public compiler API and the published
@rspack/core@2.1.4package:The repro uses a loader that reads an external
flag.txtfile. That file is explicitly listed incache.buildDependencies, so changing it should invalidate the persistent cache.Steps:
flag.txt = A.snapshot_buildscope and recompute its pack integrity hash.flag.txttoBand start a fresh process against the cache.Observed on
@rspack/core@2.1.4:The recovered build succeeds but silently emits the old result even though the explicitly configured build dependency changed.
Expected behavior
An absent/incomplete
snapshot_buildscope should invalidate the cache or conservatively rerun build-dependency validation. A changed file listed incache.buildDependenciesmust not be ignored during persistent-cache recovery.Environment
@rspack/core@2.1.4