fix(cloudflare): serve version.json as static asset

Avoid Workers billing for /version.json by removing worker-first routing and generating static _headers rules during manifest build.
This commit is contained in:
Shantur Rathore
2026-01-22 18:05:01 +00:00
parent c01846f7fd
commit b25fb0073e
3 changed files with 9 additions and 22 deletions

View File

@@ -72,4 +72,12 @@ const manifest = {
fs.mkdirSync(distDir, { recursive: true })
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n", "utf-8")
const headersPath = path.join(distDir, "_headers")
fs.writeFileSync(
headersPath,
"/version.json\n Cache-Control: no-cache\n Content-Type: application/json; charset=utf-8\n",
"utf-8",
)
console.log(`Wrote ${manifestPath}`)
console.log(`Wrote ${headersPath}`)