'react+vite how todeploy gh-page

I don't know why my repo can't run gh-page. here is my package.json

{
  "name": "krypt",
  "homepage": "https://github.com/wang19903/web",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d dist"
  },
  "dependencies": {
    "@tailwindcss/forms": "^0.4.0",
    "ethers": "^5.5.2",
    "gh-pages": "^3.2.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.3.1"
  },
  "devDependencies": {
    "@vitejs/plugin-react": "^1.0.7",
    "autoprefixer": "^10.4.1",
    "postcss": "^8.4.5",
    "tailwindcss": "^3.0.9",
    "vite": "^2.7.2"
  }
}

I have followed the step https://vitejs.dev/guide/static-deploy.html#github-pages . the other way is npm gh-page change "gh-pages -d build" to "gh-pages -d dist" because I have dist folder and Neither of them worked.

for test, I try 2 new repo, one is react&vite, followed the step and it's work. the other is npm create-react-app gh-page, followed the step and it's work also.

what did I wrong? Thank you



Solution 1:[1]

The homepage is wrong I think. Check the config vite file, add property named base.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1