Search code examples
firebasenpmfirebase-hostingfirebase-cli

Firebase deploy is deploying my source folder unencrypted


ISSUE:

My Firebase Deploy is not deploying just the minified file, but also my raw source files and folders.

Details:

I'm using the firebase deploy command, and in my firebase init, I mentioned my folder name(deploy folder name) that's supposed to be deployed.

But when I build my project with npm run build and deploy the project after transferring it to deploy folder, for some reason it also deploys my src folder with all the raw data.

Folder Structure and firebase.json: enter image description here

Inspecting my hosted site enter image description here

For some reason, I think I'm doing it wrong , as even my node_modules are being uploaded, I tried to add ./src in ignore


Solution

  • When deploying for Firebase Hosting, you don't specify which folder you want to deploy. firebase.json contains the name of the folder you want to deploy, and almost everything in it is deployed by default. If you want to exclude additional files, you'll have to figure that. Read the documentation for details on how to do that.

    The ignore attribute specifies the files to ignore on deploy. It can take glob pattern the same way that Git handles .gitignore.

    The following are the default values for the files to ignore:

    "hosting": {
      "ignore": [
        "firebase.json",  // the Firebase configuration file (this file)
        "**/.*",  // files with a leading period should be hidden from the system
        "**/node_modules/**"  // contains dependencies used to create your site but not run it
      ]
    }