reactjs - 在 gh-pages 上部署 react 项目,但页面没有更新
问题描述
我正在尝试在我的 GitHub 页面(gh-pages 分支)上部署我的反应项目。但是我的 GitHub 页面没有更新。
这是我的package.json
:
...,
"homepage': "https://marukohua.github.io/portfolio/",
"dependencies": {
...
},
"scripts": {
"deploy": "npm run build&&gh-pages -d build"
},
...
我认为这在我的路由器路径中是可能的。所以我process.env.PUBLIC_URL
在我的路由路径中使用。但是我的页面和以前一样。
这是我的路线路径:
<BrowserRouter>
<Switch>
<Route
path={`${process.env.PUBLIC_URL}/`}
exact
component={ProjectsPage}
/>
<Route
path={`${process.env.PUBLIC_URL}/about`}
component={AboutPage} />
<Route
path={`${process.env.PUBLIC_URL}/projects`}
component={ProjectsPage}
/>
</Switch>
</BrowserRouter>
解决方案
推荐阅读
- sql - 如何在 where 子句中为子查询使用别名
- python - 更改稀疏矩阵行的随机选择条目的值
- android - android片段覆盖onCreateAnimation
- arguments - nagios 命令参数通过本地 check_nrpe 命令或远程 nrpe 代理合并到 nrpe 命令名称中
- postgresql - 无效操作:在子计划目标列表中找不到变量 - RedShift
- powershell - 在组合框中选择一个项目一次
- python - 使用python匹配两个csv文件之间的列值时输出错误
- android - Recycler 视图如何绘制单独的行
- python - 创建一个游戏,其中计算机通过 <、> 或 = 的输入来猜测一个值
- codenameone - 刷新 cn1lib 文件后组件不工作