Firebase hosting: Why firebase hosted my all the source code into there hosting? How can I restrict only to "build" folder?

Viewed 128

I have build a react app and I used firebase hosting to deploy my app. It's working fine but firebase has hosted all the source code. I only need to upload build folder. How can I remove other files from the hosting?

firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

enter image description here

Is there any thing to do?

But somehow I have uploaded build folder only for another app But I cannot remember/find how I did it, I see no different between firebase.json

enter image description here

firebase,json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
1 Answers

I think you have misunderstood the things. Firebase has hosted only your build folder.enter image description here.

The above image shows the files for my react keep clone. The ts files and src folder are not generated explicitly and I am sure that your entire code has not been hosted.

Related