reactjs - 构建应用程序后反应白页问题
问题描述
我已经完成了我的项目,我想把它放在服务器上。我做到了npm run build
,将构建文件夹中的所有内容都放在服务器上,当我在浏览器上访问应用程序时,我没有收到任何错误或警告。只是一个白色的空白页。
我认为问题出在路由部分,但我不知道该怎么做或如何发现错误。
"name": "hermes-project",
"homepage": "./",
"version": "0.1.0",
"private": true,
"dependencies": {
"auth0-js": "^9.10.2",
"classnames": "^2.2.6",
"clipboard-polyfill": "^2.8.0",
"contentful": "^7.5.0",
"contentful-management": "^5.7.1",
"marked": "^0.6.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-markdown": "^4.0.8",
"react-router-dom": "^5.0.0",
"react-scripts": "2.1.8"
路由部分
<BrowserRouter>
<Router history={history} component={App}>
<div>
<Route exact path="/" render={(props) => <Login auth={auth} {...props} />} />
<Route path="/brand" render={(props) => (
!auth.isAuthenticated() ? (
<Redirect to="/login"/>
) : (
<Brand auth={auth} {...props} />
)
)} />
<Route path="/board" render={(props) => (
!auth.isAuthenticated() ? (
<Redirect to="/login"/>
) : (
<Board auth={auth} {...props} />
)
)} />
<Route path="/Profile" render={(props) => (
!auth.isAuthenticated() ? (
<Redirect to="/login"/>
) : (
<Profile auth={auth} {...props} />
)
)} />
<Route path="/login" render={(props) => <Login auth={auth} {...props} />} />
<Route path="/callback" render={(props) => {
handleAuthentication(props);
return <Callback {...props} />
}}/>
</div>
</Router>
</BrowserRouter>
解决方案
推荐阅读
- javascript - _react.default.memo 不是函数 | wrapWithConnect 问题
- android - 浮动操作按钮的高度不起作用
- sql - 有没有办法在不循环的情况下应用行更新
- suitecrm - 如何使用getbeans和关系字段
- angular - 动态插入组件时 ControlValueAccessor 不起作用
- c# - 如何在 C# 中打开新窗口而不丢失 xml 布局
- mysql - 如何查询表内相同数据但输出行位置不同
- php - 使用参考问题将 Python 代码改编为 PHP
- c# - 如何以编程方式添加/修改/删除可用的显示设置(宽度、高度、刷新率)?
- spotfire - 无参数按需数据