Issue with multiple sites deployment in Firebase

Viewed 348

I have an Angular web application called "my-app". I created a project on Google Firebase and called it "my-app" as well. I deployed the Angular application to Firebase project "my-app". As a result, a site "my-app-*****" appeared. My app was accessible on "my-app-*****.web.app" address.

Then I created the second site in Hosting of the same project. I called it "my-app-dev". It got an address but was empty because nothing was deployed yet. I followed instructions from google: https://firebase.google.com/docs/hosting/multisites And even one question on StackOverflow: Firebase hosting deploy to other site I added targets and modified firebase.json. In the result, they looked like that:

firebase.json file content:

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

.firebaserc file content:

{
  "projects": {
    "default": "my-app-*****"
  },
  "targets": {
    "my-app-*****": {
      "hosting": {
        "dev": [
          "my-app-dev"
        ],
        "prod": [
          "my-app-*****"
        ]
      }
    }
  }
}

But I faced an error when I executed command firebase deploy --only hosting:dev However, when I executed command firebase deploy --only hosting:prod, everything was deployed without errors.

As a result, I am able to deploy my project to "my-app-*****" site, but I could not deploy my project to "my-app-dev" site. I want both sites to use same built files, that is why "public" was pointing to the same directory "www". Both sites located in the same Hosting of "my-app" project on Google Firebase.

Can someone please help me and explain what have I done wrong?

0 Answers
Related