How to include subdirectories in firebase hosting
Asked Answered
C

4

5

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

Comparable answered 31/10, 2015 at 16:0 Comment(4)
This is a host configuration issue not a code issueDoubletime
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. firebase.com/docs/hosting/guide/…Bibelot
The link in the comment points to legacy documentation that is DEPRECATED AS OF MAY 18, 2016. The new documentation is at: Deployment ConfigurationRidglea
keep your caps off, folder with capital letters are not being uploaded to firestore hosting. I had a problem with my sub directory that contained some js files and was being not uploaded to firebase hosting. the sub folder name was: ./public/js/Core (NOT OK) Once i changed the capital letter of Core to core it started to be uploaded. /public/js/core (OK)Husein
G
5

(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

Garrity answered 1/11, 2015 at 19:28 Comment(0)
S
5

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.

Sexed answered 17/8, 2018 at 5:29 Comment(1)
Per my answer below, sometimes what you really have to do is the opposite!Shandishandie
E
1

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/**"
    ]
  }
}
Evangelinaevangeline answered 18/2, 2019 at 16:42 Comment(0)
S
1

If you're deploying with Firebase tools, you may need to downgrade your tools first, because versions can be released which won't actually deploy subdirectory content from Windows (for example).

I lost the past couple days assuming the bug in a deploy pipeline must have been in code I wrote that nobody else uses, instead of in multiple recent versions of Google's production code that many developers use. Downgrading from 13.11.4 to 13.11.2 worked for me and several others.

A fix for that particular issue has been merged (but not yet released). However, one should be cautious of making the assumption I made as described above, and consider downgrading as a possible solution.

Shandishandie answered 26/6 at 21:15 Comment(2)
Clearly, depending on the centralized platforms is not a good practice. We have abandoned Google Firebase and other centralized Cloud solutions in favor of descentralized OpenSource solutions (like MongoDB), identically as many others have done: #41950316Sexed
Who hosts your MongoDB data? It's on a disk with more centralized control than you probably imagine.Shandishandie

© 2022 - 2024 — McMap. All rights reserved.