From af24bfe76b40e99f948d8db28b7076351e6dc5d7 Mon Sep 17 00:00:00 2001 From: David LJ Date: Mon, 6 May 2024 18:00:16 +0200 Subject: [PATCH] perf: add compression for SSR (#441) --- server.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.ts b/server.ts index e636b765..dde51a0c 100644 --- a/server.ts +++ b/server.ts @@ -4,10 +4,13 @@ import express from 'express' import { fileURLToPath } from 'node:url' import { dirname, join, resolve } from 'node:path' import bootstrap from './src/main.server' +import compression from 'compression' // The Express app is exported so that it can be used by serverless Functions. export function app(): express.Express { const server = express() + // Manually added so Lighthouse doesn't complain about adding text compression + server.use(compression()) const serverDistFolder = dirname(fileURLToPath(import.meta.url)) const browserDistFolder = resolve(serverDistFolder, '../browser') const indexHtml = join(serverDistFolder, 'index.server.html')