firebase - 找不到 Ionic 4 和 Firebase 页面
问题描述
我最近启动了一个 Ionic 4 项目,并使用命令添加了 service woker 并将其$ ng add @angular/pwa --project app
托管在 firebase 上。它工作得既漂亮又完美,但是当我Ctrl + F5
在页面上给出一个或用它进行审核时Lighthouse
,我返回找不到页面并且只能再次工作,如果我去 url 并删除/home
,只留下 url 基础,所以他可以安装服务人员并正常工作,如果我不执行上述程序:D。如果我能得到答案,我将不胜感激。
我感谢关注。
注意:对不起我的英语,我是巴西人,我不流利。
解决方案
我在使用 Ionic 4 时遇到了完全相同的问题@angular/pwa
。
解决方案是将以下重写添加到文件中firebase.json
:
"rewrites": [{
"source": "**",
"destination": "/index.html"
}]
所以firebase.json
看起来像这样:
{
"hosting": {
"public": "www",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [{
"source": "**",
"destination": "/index.html"
}]
}
}
我希望这有帮助
推荐阅读
- python - 从 Freeman 链码生成图像矩阵
- powershell - 来自通用 Windows 平台或 .NET Standard 2.0 类库的系统信息
- php - Symfony 4 动态数据库连接和 FOS 用户
- file - dart 中的 lib/src 和 /bin 有什么区别?
- magento - Magento - 为具有特定邮政编码的用户隐藏价格
- c# - 使用 ConvertAll 转换为对象数组
- javascript - Recharts 如何按系列分组?
- r - 仅使用负数提取“=”之后的数字
- node.js - 无服务器:尝试使用 async/await 时,dynamodb 在创建记录时出现错误
- java - 我需要帮助才能正确实现 Comparable 接口