【发布时间】:2021-07-03 23:14:51
【问题描述】:
我有一个项目,其中设置了多个 Firebase 托管项目(用于暂存和生产),当我根据 Firebase 文档 here 添加重写时,函数 /bigben 的重写在 https://customdomain.com/bigben 不起作用(两者都部署到生产和模拟器中)
firebase.json
{
"hosting": [
{
"target": "production",
"public": "build",
"rewrites": [
{
"source": "/bigben",
"function": "bigben"
},
{
"source": "**",
"destination": "/index.html"
},
{
"source": "!/@(js|css|svg|jpg|png|gif|ico|json|html)/**",
"destination": "/index.html"
}
]
// ...
},
{
"target": "staging",
"public": "build",
"rewrites": [
{
"source": "/bigben",
"function": "bigben"
},
{
"source": "**",
"destination": "/index.html"
},
{
"source": "!/@(js|css|svg|jpg|png|gif|ico|json|html)/**",
"destination": "/index.html"
}
]
// ...
}
]
}
如何设置 /bigben 以使用此自定义域(已在 Firebase 中配置为托管/前端 create-react-app?我已经看到从构建文件夹中删除 index.html,但不是这样CRA 需要吗?
【问题讨论】:
标签: firebase google-cloud-functions firebase-hosting