Fix temp file ENOENT crash (#8615)
Fixes #8615
↪️ Pull Request
This should fix a crash that seems to happen to many people, including myself - see issue #8615, #8571 etc.
Full disclosure: I haven't had much success building Parcel and running tests and I really just needed this fixed ASAP, so I just tested this by editing the compiled scripts and then applying the fixes back to the original source file. There might be some issues I'm overlooking, so any help with testing and other necessary steps will be much appreciated. I haven't really seen a good fix anywhere in this repository (that doesn't cause any other issues down the road).
🚨 Test instructions
For me, the original bug happens on Windows using Parcel 2.15.0, while using the Pug preprocessor. All that's needed to crash Parcel is to run a dev script, make a small change to index.pug, save and hot-reload, make another small change, save again and after the 3rd or 4th save, it crashes pretty reliably, throwing the ENOENT error many have described in the mentioned issue. After applying my fix, it does not happen anymore and everything works well.
✔️ PR Todo
- [ ] Added/updated unit tests for this change
- [x] Filled out test instructions (In case there aren't any unit tests)
- [x] Included links to related issues/PRs
Thanks. Looks like there are a couple failing tests