Skip to content

Commit 59bafcf

Browse files
committed
chore: remove the empty runtime-config file and its plumbing
public/config.js assigned an empty object to window.env and nothing ever read it. Nothing in src, e2e, supabase, scripts, or any of the 58 static pages references window.env or globalThis.env; the app reads Vite's import.meta.env instead. It was loaded as a blocking script in <head> on every page, so removing it also drops one request from the critical path. Removes the file and everything that existed only to serve it: the script tag in index.html, the service-worker app-shell entry, the Vercel and nginx no-cache rules, and the /config.js row in the deployment-config test. Also drops a latent trap in nginx.conf. The JS/CSS caching block carried if ($request_uri ~* "config\.js") { return 404; } which matches on substring, so any hashed bundle whose URI contained "config.js" would have 404'd. With the file gone the guard has nothing to protect and is deleted rather than narrowed. The service worker degrades safely either way: install uses Promise.allSettled and only caches responses that are ok, so a missing app-shell entry could never fail installation. Verified: lint, typecheck, 924 unit tests, 121 edge tests, build, and 126 Chromium e2e tests pass. `nginx -t` passes against the real nginx:alpine image with this config mounted, and the built dist/index.html contains no config.js reference.
1 parent c7d3437 commit 59bafcf

6 files changed

Lines changed: 2 additions & 28 deletions

File tree

‎index.html‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
]
6767
}
6868
</script>
69-
<script src="/config.js"></script>
7069
<script src="/theme-init.js"></script>
7170
</head>
7271

‎nginx.conf‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ server {
1818
if ($uri ~ ^/(app(?:/|$)|login$|share/)) { set $robots_tag "noindex, nofollow"; }
1919
add_header X-Robots-Tag $robots_tag always;
2020

21-
# Do not cache runtime bootstraps so config and theme behavior update instantly.
22-
location = /config.js {
23-
expires -1;
24-
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
25-
}
26-
21+
# Do not cache the theme bootstrap so theme behavior updates instantly.
2722
location = /theme-init.js {
2823
expires -1;
2924
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
@@ -84,10 +79,6 @@ server {
8479

8580
# Cache JS/CSS bundles (Vite adds hashes to these, so caching is safe)
8681
location ~* \.(?:css|js)$ {
87-
# But exclude config.js which we handled above
88-
if ($request_uri ~* "config\.js") {
89-
return 404; # Should not happen due to the = /config.js block above
90-
}
9182
expires 1y;
9283
add_header Cache-Control "public";
9384
}

‎public/config.js‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎public/sw.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const APP_SHELL = [
1818
'/app/history',
1919
'/app/settings',
2020
'/index.html',
21-
'/config.js',
2221
'/theme-init.js',
2322
'/manifest.webmanifest',
2423
'/favicon.ico',

‎src/test/vercel-deployment-config.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe("Vercel frontend deployment configuration", () => {
127127
},
128128
);
129129

130-
it.each(["/index.html", "/config.js", "/theme-init.js", "/sw.js"])(
130+
it.each(["/index.html", "/theme-init.js", "/sw.js"])(
131131
"prevents stale caching for %s",
132132
(source) => {
133133
const config = loadConfig();

‎vercel.json‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,6 @@
8484
}
8585
]
8686
},
87-
{
88-
"source": "/config.js",
89-
"headers": [
90-
{
91-
"key": "Cache-Control",
92-
"value": "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"
93-
}
94-
]
95-
},
9687
{
9788
"source": "/theme-init.js",
9889
"headers": [

0 commit comments

Comments
 (0)