vite React 应用无法发布到github

问题描述 投票:0回答:1

我最近从react应用程序切换到vite应用程序,一切都很好,但是直到某个时候,我必须将项目推送到GitHub,以便我的同事可以看到并评估我所做的工作,它在控制台中给出了错误:无法加载资源:服务器响应状态为404。

file tree

我问了其他开发者,我也试图通过电报群得到我的问题的答案,但是他们推荐的一切都没有帮助,之后我,作为一个真正的开发者,决定谷歌,我观看了各种视频,但所有的这并没有帮助解决我的问题。

网站上没有任何内容加载,只有一个普通的白色页面。

package.json

{
  "name": "upgrade",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "macro-css": "^1.0.5",
    "node-sass": "^9.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.15.0"
  },
  "devDependencies": {
    "@types/react": "^18.2.15",
    "@types/react-dom": "^18.2.7",
    "@vitejs/plugin-react": "^4.0.3",
    "eslint": "^8.45.0",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.3",
    "gh-pages": "^6.0.0",
    "sass": "^1.66.1",
    "vite": "^4.4.5"
  }
}

vite.config.js

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  base: "/upgrade/"
})

reactjs github-pages vite
1个回答
0
投票

我喜欢你的,但什么也没回复,只是一张空白页

© www.soinside.com 2019 - 2024. All rights reserved.