rah*_*aha 8 firebase firebase-hosting angular
我想开发 angular 6 应用程序,但在部署 firebase 后只显示欢迎页面。
以下是我为部署而采取的步骤。
ng build --prod再次运行dist目录内的子文件夹中,因此我将包含 index.html 的子目录中的所有内容复制到dist/.但在完成所有这些之后,我仍然在链接中看到欢迎页面。
我究竟做错了什么!?
小智 13
尝试: 8. 文件 dist/index.html 已经存在。覆盖?(y/N) N 并在隐身模式下打开指向您的应用程序的链接。说真的,我坚持了几个小时,因为这个 firebase 索引在我的情况下被缓存了,所以这就是为什么我在部署后看不到我的应用程序的原因。
小智 5
问题是:
firebase 正在寻找该index.html文件,有时它并不直接存在于dist目录中
解决方案:
更新topublic中的路径或文件夹中文件的路径firebase.json"public":"dist/ProjectName"index.htmldist
例子
{
"hosting": {
"public": "dist/<YourProjectName>",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/dist/index.html"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3513 次 |
| 最近记录: |