I tried deploying my angular
4 application on firebase
but the setup did not ask me for any configuration as mentioned here: https://alligator.io/angular/deploying-angular-app-to-firebase/ and many similar answers on stack. Out of following 5 steps that firebase cli runs through on running firebase init
, I was only asked for step1 and not for others.
- Firebase CLI features…: Hosting.
- Database rules file: You can keep that default file name that they provide, or change it if you prefer. This file will be created and will contain the database rules for your app.
- Public directory: Type in dist, because this is where your production-ready Angular app assets are.
- Configure as single-page app: Most of the time you’ll say yes (y) for this one.
- Overwrite index.html: No.
Hence the firebase.json
generated in root directory was empty:
{}
Then when I ran firebase deploy
, I got this error:
Error: Cannot understand what targets to deploy. Check that you specified valid targets if you used the --only or --except flag . Otherwise, check your firebase.json to ensure that your project is initialized for the desired features.
I then googled for the firebase.json
content that should have been created normally, then I pasted the below in json and deployed, it was successful:
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Any reason why firebase didnot ask for configuration? Am I using the right content in firebase.json? I found "ignore" setup as well in this file here. Can anyone share the correct content. TIA.
After you run
firebase init