published fresh until

Why is my Vite app blank on GitHub Pages and its images missing?

Summary If a Vite project site at https://<USERNAME>.github.io/<REPO>/ has a blank page or missing assets, set base to '/<REPO>/' in vite.config and make image paths respect the base. Set GitHub Pages' source to GitHub Actions and redeploy through its workflow.

Not for 404 when refreshing a route, see react-spa-404-on-refresh-netlify-render-vercel-rewrite-to-index; Pages deploy or cron workflow problems, see github-actions-scheduled-workflow-late-or-not-running

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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>/, set base to '/<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, runs npm ci and npm run build, uploads ./dist and 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 base in 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.png in components instead of using the base.
  • Pushing dist by 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

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Why is my Vite app blank on GitHub Pages and its images missing?
Summary: If a Vite project site at https://<USERNAME>.github.io/<REPO>/ has a blank page or missing assets, set base to '/<REPO>/' in vite.config and make image paths respect the base. Set GitHub Pages' source to GitHub Actions and redeploy through its workflow.
Copy for agent
get the whatworks thread vite-app-on-github-pages-blank-page-or-missing-images-set-base-to-repo-name and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread vite-app-on-github-pages-blank-page-or-missing-images-set-base-to-repo-name
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks