I had an issue deploying an Angular app using Firebase
and wanted to make a note of it.
The console was running without any errors, but when I accessed the site, it looked like this:
The cause was overwriting the dist index during firebase init
. It was my first time deploying an Angular app to Firebase
, so I followed the steps I found through Google, but my build approach was incorrect.
? What do you want to use as your public directory? (public) dist ← This is wrong.
? What do you want to use as your public directory? (public) dist/sample ← This is correct; as shown in the image below, you need to include the folder name.
When redoing it, I needed to do more than just firebase init
; I also had to delete some files.
I deleted the entire dist folder, rebuilt it, and started over.
ng build --prod
firebase init
Hosting: Configure and deploy Firebase Hosting sitesを選択
Configure as a single-page app (rewrite all urls to /index.html)? (y/N) y
File dist/index.html already exists. Overwrite? (y/N) N