- Before deploying the app to firebase, we should always make sure that the app is bundled into the
/build
directory. In our specific case, we use npm to spit out the/build
directory usingnpm run build
script on the command-line. - Now we can deploy the contents of the
/build
directory onto firebase (where we choose the Hosting service). But before that, we can setup the Firebase CLI from these docs here. - Instead of following the docs, we can:
- Install the
firebase-tools
— command:npm install -g firebase-tools
. - Once the
firebase-tools
are installed, we can authenticate by signing into the respective google account using the command:firebase login
- Then we initialize our project as a firebase project using the command:
firebase init
. Choose the Hosting: Configure and deploy Cloud Functions option. After that, give the name of the directory where the entire project is built (eg.build
directory in this case). Firebase CLI will present some options as follows:- Configure as a single-page app (rewrite all urls to /index.html)? (y/N) — in our case it is 'y'.
- File build/index.html already exits. Overwrite? (y/N) — in our case it is 'N'.
- Finally, we deploy the project using the command:
firebase deploy
- Install the