我有一个反应项目,我想部署到Firebase,它firebase serve
时工作正常,但我得到类似的东西 你看到这个是因为你已经成功设置了火碱托管。现在是时候去建造一些非凡的东西了!firebase deploy
之后,
为什么会这样?
答:我发现了问题。firebase.json
文件已从
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
}
}
对此
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [{ "source": "/service-worker.js", "headers": [{ "key": "Cache-Control", "value": "no-cache" }] }]
}
}
它奏效了,为了更多参考, https://create-react-app.dev/docs/deployment/