Turbo cache is leaving stale outputs when sources are removed #10953
Replies: 3 comments
-
|
Hi, thanks for the issue, though this is expected behavior, since That said, it sounds like there's a worthy feature request here. Something like: This would tell Turborepo to first wipe the disk at the location(s) where its about to write to. Does that sound like what you're looking for? |
Beta Was this translation helpful? Give feedback.
-
|
@anthonyshew thanks for the quick reply! Yes I agree that having something like that would help a lot to avoid these issues. |
Beta Was this translation helpful? Give feedback.
-
|
Makes sense. I'll move this over to a Dicussion, since we do feature requests there. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Verify canary release
Link to code that reproduces this issue
https://github.com/bmbferreira/turbo-cache-removed-file-test
Which canary version will you have in your reproduction?
2.5.9-canary.7
Environment information
Expected behavior
After the final build, the
dist/folder set as output for thebuildtask should only contains outputs for files that still exist insrc/folder.Actual behavior
If we delete a source file like src/index2.ts, but the corresponding
dist/index2.jsstill exists from a previous build, it won’t be removed when the cache is hit.To Reproduce
Start by cloning this repository and commenting out the dependsOn line in turbo.jsonc.
Additional context
This is especially problematic for migration files when using something like TypeORM. If a migration is added and later removed, it isn’t deleted from dist, which means old migrations that no longer exist in src can still be executed. When this happens, we need to run a full rebuild with turbo build --force.
Beta Was this translation helpful? Give feedback.
All reactions