Bugfix. Extract react imports from main bundler to vendor static files

This commit is contained in:
2026-04-08 05:39:11 +01:00
parent c19b7c9607
commit 4b3a4dbc77
38 changed files with 825 additions and 253 deletions
+11 -3
View File
@@ -19,13 +19,21 @@ export default async function ({ req }) {
});
}
}
export function readFileResponse({ file_path }) {
export function readFileResponse({ file_path, cache }) {
if (!existsSync(file_path)) {
return new Response(`Public File Doesn't Exist`, {
status: 404,
});
}
const file = Bun.file(file_path);
// let res_opts: ResponseInit = {};
return new Response(file);
const headers = new Headers();
if (cache?.duration == "infinite" || (cache && !cache.duration)) {
headers.set("Cache-Control", "public, max-age=31536000, immutable");
}
else if (cache?.duration) {
headers.set("Cache-Control", `public, max-age=${cache.duration}`);
}
return new Response(file, {
headers,
});
}