Angular 6.0 firebase hosting deploy not working

dotGitignore picture dotGitignore · May 16, 2018 · Viewed 11.6k times · Source

I am looking for a tutorial on how to properly setup the firebase-tools hosting on my angular 6.0 projects, and what I found is always like this.

- firebase init 
- then select the Hosting
- What do you want to use as your public directory? dist
- Configure as a single-page app (rewrite all urls to /index.html)? Yes
- Overwrite? No
- ng build --prod
- firebase deploy

but after doing this, this is always what I've got.

default

Answer

dotGitignore picture dotGitignore · May 16, 2018

I found that the ng build --prod will create a dist and an another subfolder under this where the project location is.

dist
|--TheProject_Folder
|  |--assets|index.html - This index html is not using.
|--index.html - This is the html generated in the firebase init

So what I did is to initialize again the firebase init and change the public directory from dist to dist/TheProject_Folder:

- What do you want to use as your public directory? dist/TheProject_Folder
- Configure as a single-page app (rewrite all urls to /index.html)? Yes
- Overwrite? No