Skip to content

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

@aalej

Description

@aalej

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 - firebase/firebase-tools#9773

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions