Search code examples
firebase-hosting

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


After upgrading my Firebase project, I got this warning message when deploying my project to Firebase hosting.

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

Anyone has the same problem? How can I fix this?


Solution

  • You just need to modify your firebase.json file which I assume looks somewhat like this:

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

    You need to move the different keys specified (in this case, public, ignore and rewrites key) to the hosting key so the snippet above would look like below.

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

    Check out this link for more info on Firebase hosting deployment configuration.