为什么Firebase Serve工作正常,但Firebase Deploy却不能?



我有一个反应项目,我想部署到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/

相关内容

  • 没有找到相关文章

最新更新