Fixing astro.build/Vite hot reload crash ENOENT file not found

If you ever get an error about a ‘4913’ file not existing, making the dev server crash when developing with Astro or Vite in general, I have good news for you: I found out why and here is the fix.

Vim creates a temporary 4913 file.

It has its reason. If you want to know why: github link.

The fix

Ignore the file in Vite hot reload.

js
vite: {
server: {
watch: {
ignored: "**/4913";
}
}
}