So I’m new to web dev and I’ve been building a React site just to try it out. It worked great locally, and so then I followed a tutorial to get it hosted on github. The build and deploy process goes smoothly, nothing seems wrong. Then I try to open the site and it’s just a blank white page and inspect is telling me.
Failed to load resource: the server responded with a status of 404 ()
Here is the full repo
I tried pushing it to a fresh github repo, on the off chance something just went wrong within git somehow. Other than that, I haven’t tried too much and have been really stuck 🙁
2
Answers
You seem to be using a GitHub workflow that’s not actually building your content. When looking into your Actions (the feature of GH that can build your site for you) I found that Jekyll (a static site generator) is used for rendering. It only finds your assets and the
index.html
file, which is what you’re seeing in the browser. In this case, that’s wrong since you want to use Vite and not Jekyll to build the site. Vite has an article on deploying your static site here.As I can notice, you have declared
src/main.tsx
file as the main file that deals withroot node
of your application.In the
createRoot()
where you are fetchingdocument.getElementById("root")
, there is unexpected!
that should not be there.the
createRoot()
is expected to be written like this:-