This PR fixes an issue where Vite crashes when a file is deleted. This is because we don't cleanup files/folders in the scanner when they are being deleted. This results in an issue where we would use Vite's `addWatchFile` API with deleted files. This PR fixes that by making sure that when we re-scan the filesystem that we clear out files/folders (and recompute globs). Note: `candidates` themselve are still append-only until a fresh compiler instance is created since the TypeScript based compiler relies on that behavior. Fixes: #17532 Closes: #20111 ## Test plan 1. Added an integration test based on the issue 2. Tested it directly in the reproduction repo Before deleting: <img width="988" height="1376" alt="image" src="https://github.com/user-attachments/assets/0f104ff3-0f88-415a-8311-1cf54ab75d21" /> Before: <img width="1389" height="1376" alt="file-1b446568bfad50e6a8105d7be33f15f0" src="https://github.com/user-attachments/assets/d2fbf03e-ca22-4bc4-9bb4-f3de10b90b99" /> Which results in: <img width="988" height="1376" alt="image" src="https://github.com/user-attachments/assets/8320d61c-4210-4aa8-aa8d-98c5327e9604" /> After: <img width="1389" height="1376" alt="file-c36ab0265856da5bb7c7a1e77427b821" src="https://github.com/user-attachments/assets/2ec4c4ea-aa79-4a51-900a-e247dcdb976c" /> Which results in: <img width="988" height="1376" alt="image" src="https://github.com/user-attachments/assets/8e8dec0d-40eb-4e54-b5fd-8d22abd55973" /> [ci-all] |
||
|---|---|---|
| .. | ||
| cli | ||
| oxide | ||
| postcss | ||
| upgrade | ||
| vite | ||
| webpack | ||
| package.json | ||
| utils.ts | ||
| vitest.config.ts | ||