Search code examples
angularfirebase-hostingfirebase-tools

Angular 6.0 firebase hosting deploy not working


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


Solution

  • 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