Search code examples
reactjsweb-deploymentgithub-pagesvite

Blank page when deploying a react app to github pages and vite


When i try to deploy my react app to github pages with the package gh-pages, the result page is blank.result page

The page I am trying to deploy is here: LINK I don't know if it matters but I am currently using the free domain given to me by GitHub: www.elvas.me

I tried following the react official docs: Link, but it didn't work for me... Perhaps it's because I am using vite and not create-react-app?

*Edit*

Found out that the site is trying to get the .js and the .css from the wrong place. enter image description here

I just don't know what I am doing wrong...


Solution

  • Ok, so to solve this the only thing that I had to do was to add base:"{repName}" to the vite.config.ts file.

    Source: https://vitejs.dev/guide/static-deploy.html

    The images were not loading, I used this to fix them: Github pages vite JS build not showing the images