Add etag for immutable assets

This commit is contained in:
Jon Staab
2026-05-12 08:46:50 -07:00
parent 0998639d59
commit ab21008f34
2 changed files with 10 additions and 2 deletions
+8
View File
@@ -247,6 +247,14 @@ app.use(
: "public, max-age=3600"
context.header("Cache-Control", cacheControl)
// Immutable assets are content-hashed by Vite, so the filename is itself a
// stable content identifier. Exposing it as an ETag lets clients that
// revalidate explicitly (e.g. emoji-picker-element checks its data source
// on every load) skip re-downloading large files when nothing changed.
if (isImmutable) {
context.header("ETag", `"${path.basename(filePath)}"`)
}
},
}),
)