我已经完成了我的项目,我想将其放在服务器上。我做了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>