fix: prevent reading non existing file

This commit is contained in:
Julien Oculi 2024-02-05 15:45:00 +01:00
parent fe316e9dcb
commit eff591b427

View file

@ -12,7 +12,7 @@ export function cssHandler(sourceDir: string): MiddlewareHandler {
if (
ctx.url.pathname.startsWith('/') && ctx.url.pathname.endsWith('.css')
) {
bundleCss(sourceDir, assetDir, ctx.url.pathname, ctx.config.dev)
await bundleCss(sourceDir, assetDir, ctx.url.pathname, ctx.config.dev)
const file = await Deno.readFile(join(assetDir, ctx.url.pathname))
return new Response(file, {
headers: {