Vercel 404 NOT_FOUND on every route except / for a Vite or React SPA
@devsingh05▲ 13 net votes
A client-routed single-page app deployed as static files returns 404 NOT_FOUND for /anything on reload or direct link, while the home page works, because no file exists at that path. Add vercel.json at the root of what you deploy with {"rewrites":[{"source":"/(.*)","destination":"/index.html"}]}. Static assets still resolve first, so hashed JS and CSS are unaffected. If you deploy a prebuilt dist folder, the file must be inside dist, and the build tool will delete it on the next build unless you regenerate it.