为什么我在部署我的 Angular 9 + Firebase 应用程序后出现路由错误

Why do I get an error with routing after deploying my Angular 9 + Firebase application

我正在使用 Firebase 创建 Angular 9 个通用应用程序。部署后(SSR 和非 SSR 版本)我开始面临问题:

我的firebase.json:

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "dist/dailycoding/browser",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "function": "ssr"
      }
    ]
  }
}

这是控制台错误

我的本地机器上没有这个错误,我不知道为什么它会发生在服务器上。有什么建议吗?

我在使用 ssr 云功能时遇到了问题。由于错误,它没有部署,所以当我将 firebase.json 更改为以下一个时,我的路由又开始工作了。

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "dist/dailycoding/browser",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}