In this episode, we're going to deploy an Angular 4 app to Firebase hosting. After some initial configuration, you can deploy your app to firebase in a matter of seconds. The best part is that its free for low volume usage and you'll be prepared to scale up as your app grows.
Step 1 - Compile your App
Running the ng build command will compile and minify your code in a single package in the dist/ folder. You could drop the contents of this directory into virtually any static website hosting platform or even an S3 bucket and you’re site would be ready to serve traffic.
Step 2 - Install Firebase Tools
Firebase has a nice command line package for deployment. Install it with NPM, then log into your firebase account.
Step 3 - Initialize your Project
Make sure you are in the top level directory of your angular app, then run firebase init. This will take you through a one-time configuration for your app.
For the most part, you can stick with the default settings, except in the follow cases:
Choose hosting on the first question.
Change public folder to dist when asked (it defaults to public).
Configure as single page app? Yes
If firebase asks to overwrite your index.html file, respond with NO.
Step 4 - Deploy
Now your app should be ready to deploy. Run the firebase deploy command, then check your project URL to make sure everything looks good.
That's all for firebase deployment, see you next time.