Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I comment on firebase.json file?

I need to comment out some lines from the firebase.json file:

Example:

"rewrites": [
      // {
      //  "source": "/blog/*", 
      //  "function": "handleBlog"
      // },
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]

In this case, I want to disable that rewrite temporarily but I do not want to delete the code.

The fact is that JSON files do not allow comments and I get an error from VSCode telling me that.

But if I set the Language Mode to JSON with Comments, the errors from VSCode are gone.

enter image description here

But is it safe to do? How does Firebase handle a firebase.json file with comments?

like image 579
cbdeveloper Avatar asked Oct 16 '25 14:10

cbdeveloper


1 Answers

I've had commented JSON in my one of my firebase.jsons for a while without issue.

{
    "hosting": {
        "headers": [
            /*{
              "source": "*.html",
              "headers": [
                {
                  "key": "Content-Security-Policy",
                  "value": "default-src 'self' ..."
                }
              ]
            },*/
        ]
    }
}
like image 140
abraham Avatar answered Oct 18 '25 08:10

abraham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!