I have two Firebase hosting sites in >Firebase >Hosting >Main (https://console.firebase.google.com/u/0/project/example/hosting/main)
1. **foobar**.web.app (default project from setup process)
2. **example**.web.app (added as an additional web app under the main project and linked for hosting)
These are my .firebaserc settings:
{
"targets": {
"foobar": {
"hosting": {
"foobar": [
"foobarWebApp"
]
}
},
"example": {
"hosting": {
"foobar": [
"foobarWebApp"
],
"example": [
"foobar"
]
}
}
},
"projects": {
"default": "foobar"
}
}
After running firebase deploy from the Firebase CLI the files get deployed to foobar.web.app. How to change it to example.web.app?
I tried firebase deploy --only hosting:example
but that always returns Error: An unexpected error has occurred.
Have you set up the hosting target correctly?
In your CLI,
firebase target:apply type target-name resource-name
hosting
.foobar
or example
After you've set up deploy targets for your Firebase resources, reference the applied target names in your firebase.json
configuration file.
See https://firebase.google.com/docs/cli/targets
EDIT:
Your .firebaserc
should look something like this, (although running that command line statement above should change this already for you, and all you need to update is the package.json
):
"projects": {
"default": "project-name"
},
"targets": {
"project-name": {
"hosting": {
"example": [ // target-name
"example-website" // resource-name
],
"foobar": [ // target-name
"foobar-website" // resource-name
]
}
}
}
made sense to me to break it down into "definitive descriptive variables"
ex .firebaserc file
{
"targets": {
"firebaseProjectID": {
"hosting": {
"targetValueInFirebase.json": [
"yourFirebaseHostingDomain"
]
}
}
},
"projects": {
"cli_alias": "firebaseProjectID"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With