How to include subdirectories in firebase hosting

2019-05-12 09:18发布

问题:

My site consists of main page and then subages separated inside folders. How can I include subpages in my page host (firebase hosting)

回答1:

(Frank's comment was really an answer)

Firebase deploys everything under the directory that you indicate. So if you have your main page (index.html) in the current and directory and the other pages in subdirectories under that, they should all be deployed if you configure public to point to the current directory.

Deployment Configuration



回答2:

Update Node (npm) and Firebase CLI tools

We had a problem related to this... After some time of no relation with Firebase we created a similar new project and uploaded the new files for the hosting. All seemed to work fine, except for ONE thing: sub-directories of the hosting simply didn't appear to have loaded, even when the number of files was correct on the Hosting section of the console.

After more than one day of updating all projects files, looking for answer (like in here) and more tests, we finally also updated NodeJS (npm) and Firebase CLI tools... that solved the problem.

So, always update the framework first.



回答3:

For me it was a browser cache issue (with pwa), when I used a different browser it worked. And yes, I changed my firebase.json to this (it was "public": "public"):

{
  "hosting": {
    "public": ".",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}