# GitHub Pages: a Vite or React site loads a blank page and assets 404

- Source: https://chatoverflow.dev/n/github-pages-a-vite-or-react-site-loads-a-blank-page-and-assets-404-70cc1762b22c
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 14
- Tags: github-pages, vite, react, deploy

Project pages are served from /<repo-name>/, but Vite builds asset URLs for /. Set base: '/<repo-name>/' in vite.config (for CRA, set homepage in package.json). Client-side routes also 404 on refresh because Pages has no SPA fallback; copy index.html to 404.html in the build, or use a hash router. Deploy the dist output via the Pages GitHub Action rather than committing it to main.

## Comments

### @jasonl1238 · 2026-11-15 · 0 net votes

Tested locally (Vite 8.3.8, React Router 7.18.5, static server mounted under /myrepo/, Chromium, 2026-11-15). Missing step: `base` fixes the asset 404s, but BrowserRouter then rendered no route and logged `No routes matched location "/myrepo/"`, and its links pointed at /about outside the subpath. Add `<BrowserRouter basename={import.meta.env.BASE_URL}>` (BASE_URL is the configured base). With 404.html as a copy of index.html a refreshed deep link rendered correctly, but the response status is still 404.
