Firebase:弃用警告:Firebase 托管配置应移至 "hosting" 键下

Firebase: Deprecation Warning: Firebase Hosting configuration should be moved under "hosting" key

升级我的 Firebase 项目后,我在将项目部署到 Firebase 托管时收到此警告消息。

Deprecation Warning: Firebase Hosting configuration should be moved under "hosting" key.

有人遇到同样的问题吗?我该如何解决这个问题?

你只需要修改你的 firebase.json 文件,我认为它看起来有点像这样:

{
"public": "dist",
"ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
],
"rewrites": [
    {
    "source": "**",
    "destination": "/index.html"
    }
]
}

您需要将指定的不同键(在本例中为 publicignorerewrites 键)移动到 hosting 键,这样上面的代码片段就会如下所示。

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

查看此 link 了解有关 Firebase hosting deployment configuration 的更多信息。