Search code examples
reactjsgithubgithub-actionsgithub-pagesvite

Request path is wrong when deployed to github pages


I want to deploy https://github.com/S-N-O-R-L-A-X/Bridge-Tools to https://s-n-o-r-l-a-x.github.io/Bridge-Tools/.

The deployment seems working well but the page is white. I have searched for some pages and tried as they said but I haven't used router.

By the way, I guess that it is because of the wrong path. Maybe the path should be https://s-n-o-r-l-a-x.github.io/Bridge-Tools/assets/index-785ed399.css. However, I don't know where to change it.

package.json is as follows

  "homepage": "https://S-N-O-R-L-A-X.github.io/Bridge-Tools",
  "name": "Bridge-Tools",
  "private": false,


Solution

  • It would appear your defineConfig does not set the base: '/Bridge-Tools/', as mentioned in vite's guide for static sites deployed on GH pages.

    For example you should be able to see in the developer tools that at the moment it is experiencing an error in failing to retrieve https://s-n-o-r-l-a-x.github.io/assets/index-fb37b952.js and https://s-n-o-r-l-a-x.github.io/assets/index-785ed399.css