Lis*_*isa 2 firebase reactjs webpack firebase-hosting react-router
那里,
我正在为这个应用程序使用react-router。它在我的本地服务器上运行良好。这是代码:
var routes = (
<Router history={browserHistory}>
<Route path="/" component={App} />
<Route path="/concepts" component={Concepts} />
<Route path="/ssdb" component={SolarSystem} />
<Route path="/missions" component={Missions} />
</Router>
)
Run Code Online (Sandbox Code Playgroud)
但是,当我使用 webpack 部署到 firebase 服务器时,该路由不再起作用。该网址显示“此文件不存在,当前目录中未找到index.html,根目录中未找到404.html”。
我错过了什么吗?谢谢!
事实证明,我们需要将重写添加到 firebase.json。希望它对其他人的类似问题有所帮助。
"rewrites": [{
"source": "**",
"destination": "/index.html"
}]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1497 次 |
| 最近记录: |