website: precompress static files instead of relying on fastify compress

- no need to generate the compressed files at runtime
- this prevents an issue with fastify compressing pagefind files
This commit is contained in:
Emmanuel Pelletier
2024-05-13 14:36:23 +02:00
parent 32a70597f9
commit 0593bbad15
4 changed files with 11 additions and 201 deletions

View File

@@ -1,15 +1,14 @@
import { join } from "path"
import Fastify from "fastify"
import fsfStatic from "@fastify/static"
import fsfCompress from "@fastify/compress"
const fastify = Fastify({
logger: true,
})
fastify.register(fsfCompress)
fastify.register(fsfStatic, {
root: join(import.meta.dirname, process.env.STATIC_DIR || "dist"),
preCompressed: true,
})
try {