How to deal with Vite manifest not found on a Forge server

Forge

Something really annoying since the invention of Vite and when deploying to a Laravel Forge server is this:

[previous exception] [object] (Illuminate\\Foundation\\ViteManifestNotFoundException(code: 0): Vite manifest not found at: 
/home/forge/project.example.com/public/build/manifest.json at 
/home/forge/project.example.com/vendor/laravel/framework/src/Illuminate/Foundation/Vite.php:728)

The quick and dirty way of solving this problem is to comment out this in your root .gitignore file:

#/public/build

However, you'll still sit with the dreaded problem of having to swap in and out of `npm run dev` and `npm run build` all the time.

This problem is also hard to google. Everyone is struggling with the same problem and especially so on non Forge servers.

Even Povilas wrote about this:
https://laraveldaily.com/post/laravel-vite-manifest-not-found-at-manifest-json