superstatic always loads configs from existing `firebase.json` file on project root

Open
#503 0 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

@jabrailkhalil is already working on this.

Since Oct 3, 2026.

  • #536 by @swseverance — closed without merging
  • #593 by @jabrailkhalil — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
firebase, javascript
Domain
backend

Research direction

Start with the index.js reproduction and trace superstatic.server startup with the supplied config while a firebase.json exists in the project root. Compare the resulting headers with and without firebase.json, then add coverage showing that explicit config is not unexpectedly overridden; done means the firebase.json-only header is absent in the reproduced case.

Written by the indexing model from the issue text.

Description

Would it be possible to prevent superstatic from automatically loading hosting configs from firebase.json?

When I run a code like

index.js
const superstatic = require('superstatic');

const options = {
    host: "127.0.0.1",
    port: 5004,
}

const config = {
    "public": "public",
    "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
    ],
    "site": "demo-project"
}

const server = superstatic.server({
    debug: false,
    port: options.port,
    hostname: options.host,
    config: config,
    compression: true,
    cwd: process.cwd() || undefined,
}).listen(() => {
    const siteName = config.target || config.site;
    const label = siteName ? "hosting[" + siteName + "]" : "hosting";
    if (config.public && config.public !== ".") {
        console.log("BULLET", label, "Serving hosting files from: " + config.public);
    }
    console.log("SUCCESS", label, "Local server: " + "http://" + options.host + ":" + options.port);
});

server.on("error", (err) => {
    console.log("DEBUG", `Error from superstatic server: ${err.stack || ""}`);
    throw new Error(`An error occurred while starting the hosting development server:\n\n${err.message}`);
});

with a firebase.json file on project directory

firebase.json
{
  "hosting": {
    "public": "public",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ],
    "headers": [
      {
        "source": "/",
        "headers": [
          {
            "key": "header-in-firebase-json",
            "value": "ehhhhhhhhhhhhh?????"
          }
        ]
      }
    ]
  }
}

Running curl -I http://127.0.0.1:5004 will output a header-in-firebase-json(only specified in firebase.json) in the response headers even though I did not specify is in the config(index.js)

$ curl -I http://127.0.0.1:5004
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 234
ETag: a3b67dafcd419de50643d682c2fb2e15
Last-Modified: Thu, 22 Jan 2026 12:59:07 GMT
Vary: Accept-Encoding
header-in-firebase-json: ehhhhhhhhhhhhh?????
Date: Thu, 22 Jan 2026 13:07:54 GMT
Connection: keep-alive
Keep-Alive: timeout=5

mcve - https://github.com/aalej/superstatic-503
related to - https://github.com/firebase/firebase-tools/issues/9773

Dominant language
TypeScript
Stars
1.1k
Forks
90
Avg merge
3d 19h
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/superstatic

All issues in firebase/superstatic

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.