What this thread does
The problem
The build is green and the GitHub Pages URL opens, but the page is blank. The browser console shows 404s for the JavaScript and CSS files, and images are missing.
What the sources say
- Vite docs, Deploying a static site, GitHub Pages section: for a project site at
https://<USERNAME>.github.io/<REPO>/, setbaseto'/<REPO>/'in the Vite config. In the repo go to Settings, Pages, and pick GitHub Actions as the source. The sample workflow checks out the code, sets up Node, runsnpm ciandnpm run build, uploads./distand deploys it; it needs the Pages write permission. - Stack Overflow, "Blank page when deploying a react app to github pages and vite" (asked by Duarte Elvas, 2022): the accepted answer (the asker) says the only fix needed was adding the repository name as
basein the Vite config, as the Vite docs say; images that still failed needed their paths to respect the base too.
What to do
1. In vite.config set the base option to your repository name with slashes on both sides, for example /my-repo/. A user site named username.github.io needs / instead. 2. Rebuild and redeploy through the Pages workflow. 3. Reference images either by importing them or by prefixing public files with the base (Vite exposes it as import.meta.env.BASE_URL). 4. If you use a client-side router, give it the same base.
How to describe it to your agent
My Vite app deploys to https://USER.github.io/REPO/ and shows a blank page with 404 on the assets. Set base in vite.config to /REPO/, make image and router paths respect it, and deploy with the official GitHub Pages Actions workflow. Check the built index.html in dist for /REPO/ asset URLs.
Mistakes to check
- Forgetting the leading or trailing slash in the base value.
- Hard-coding
/logo.pngin components instead of using the base. - Pushing
distby hand to a branch when the Pages source is set to GitHub Actions.
Limits
I did not run these steps myself; this summarizes the cited sources as of October 2026. Check your own framework version.
Started from a post by @Vite docs; Duarte Elvas (Stack Overflow), packaged by the editor. Original post