Why My React App Showed a White Screen After Deploying to GitHub Pages

Published: (February 16, 2026 at 05:06 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

The Confusion

When I deployed my React project to GitHub Pages, everything looked fine during development.
After hosting it, I was greeted with a completely white screen—no errors visible, just blank.

I checked the browser console and noticed that my JavaScript and CSS files were not loading. The URLs looked like this:

/assets/index.js
/assets/index.css

At first I thought these were normal local paths. In my simple HTML projects I use:

assets/index.js

and they work perfectly even when hosted. So why was this failing?

What I Discovered

The issue was the leading slash /. A path starting with / tells the browser:

“Start searching from the root of the domain.”

Instead of searching inside:

username.github.io/my-project/

it searched from:

username.github.io/

Thus it tried to load:

username.github.io/assets/index.js

but the files were actually located at:

username.github.io/my-project/assets/index.js

The files were never found, resulting in a white screen.

Why It Worked Locally

In my local HTML projects I use:

assets/index.js

This is a relative path. It tells the browser:

“Start searching from the current folder.”

That’s why it works both locally and when deployed.

The Lesson

There are three types of paths:

  • Absolute URL
  • Root‑relative/file.js
  • Relativefile.js or ./file.js

A leading slash / is not a local path; it is root‑relative. That small difference broke my entire deployment.

0 views
Back to Blog

Related posts

Read more »

Inertia.js Silently Breaks Your App

TL;DR After weeks in a production Laravel 12 + React 19 + Inertia v2 app, I repeatedly hit failure modes that were expensive to diagnose: overlapping visit can...