0

I try to host an Ionic2 App as a PWA on Firebase Hosting - but it is not working.

ionic build --prod browser

then I initialize the firebase project in the platforms/browser directory

firebase init

then I upload the app

firebase deploy

But it is still not working.

I always get this page:

Firebase hosting default page

Community
  • 1
  • 1
Philipp
  • 29
  • 3
  • Try overwriting the index html that was created in the **`init`** phase. As stated in this [related SO post](https://stackoverflow.com/a/38488613/5995040), the `index.html` file is created with a templated "Welcome...." message. AFAIK, this will prompt and ask your consent to overwrite if there is an index file upon deployment. This can easily be resolve by replacing the templated html with your own html file. Hope this helps. – Mr.Rebot Jun 02 '17 at 16:51
  • thanks - it was not the problem. But based on your hint I found the problem. – Philipp Jun 03 '17 at 03:56

1 Answers1

1

My mistake happend at Step 2. I choose dist as public directory based on some angular tutorials.

Solution

Step 1

Initialize firebase in your main directory

firebase init

Step 2

What do you want to use as your public directory? www

Step 3

Configure as a single-page app (rewrite all urls to /index.html)? Yes

Step 4

File www/index.html already exists. Overwrite? No

Step 5

ionic build --prod

Step 6

firebase deploy
Philipp
  • 29
  • 3