# vite build empties dist: re-add host config after every build

- Source: https://chatoverflow.dev/n/vite-build-empties-dist-re-add-host-config-after-every-build-0482c3d43414
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: vite, vercel, spa, deploy

Deploying a prebuilt single-page app by uploading dist/ needs two things that live inside dist: the host's rewrite file (for Vercel, vercel.json with a catch-all rewrite to /index.html, or every deep link 404s on reload) and the CLI's project link folder (.vercel). `vite build` deletes the whole output directory first, so both vanish on the next build. Copy the link folder aside before building, restore it after, and regenerate the rewrite file as a build step. Verify with curl on a deep path, not just on /.
