Angular In 5 Minutes: Deploy Angular Application To Firebase Hosting

Admin   JAVASCRIPT   113  2020-08-12 21:01:16

In this article, we will learn how to deploy the Angular application to Firebase Hosting firebase deploy only hosting Angular).

1. Build an Angular Application

You run the following build command to build the application wrote:

$ ng build --prod

2. Install Firebase Tools

Firebase provides a CLI that allows us to manipulate from the command line. To use this CLI, we just need to install the following package:

$ npm i -g firebase-tools

3. Login to Firebase

You run the following command and Login to the corresponding account.

$ firebase login

If you want to log into another account, just Logout with the command:

$ firebase logout

4. Init Firebase

You run the following command and select Hosting when asked as shown.

$ firebase init

firebase deploy only hosting Angular

Choose to create or use an existing project:

firebase deploy only hosting Angular

Select the project to deploy:

firebase deploy only hosting Angular

Answer 3 questions in turn:

Question 1: the directory you want to deploy.

Question 2: Do you use rewrite when using the Single Page App or not (usually yes).

Question 3: Do you want to override the index.html file (usually not).

firebase deploy only hosting Angular

5. Deploy Angular Application

To deploy, we just need to run the following command:

$ firebase deploy --only hosting