mirror of
https://github.com/docmost/docmost.git
synced 2026-08-26 00:07:04 +08:00
chore: compress and lazy load client code (#2425)
This commit is contained in:
@@ -71,6 +71,16 @@ export class StaticModule implements OnModuleInit {
|
||||
await app.register(fastifyStatic, {
|
||||
root: clientDistPath,
|
||||
wildcard: false,
|
||||
preCompressed: true,
|
||||
setHeaders: (reply: any, pathName: string) => {
|
||||
// Vite content-hashes everything under /assets, so they can be cached forever
|
||||
if (/[\\/]assets[\\/]/.test(pathName)) {
|
||||
reply.header(
|
||||
'Cache-Control',
|
||||
'public, max-age=31536000, immutable',
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
app.get(RENDER_PATH, (req: any, res: any) => {
|
||||
|
||||
Reference in New Issue
Block a user