我已经在 firebase 上部署了我的 React 应用程序,当我重新加载页面时,它显示了下面的页面。
Firebase.json
{
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
}
}
不是单页应用程序
最佳答案
添加以下内容 rewrites
规则:
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
这将确保 Firebase 为您请求的任何路由提供您的 React 应用程序。
关于reactjs - 出现 404-Page Not Found 错误,当我重新加载 Firebase 上的 React 应用程序时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61819746/