From 342c724dda3d938ccec5b4eea8233b12be564157 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Mon, 5 Feb 2024 16:05:36 +0100 Subject: [PATCH] fix: disable source map bundle --- plugins/css_bundler/src/middleware.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/css_bundler/src/middleware.ts b/plugins/css_bundler/src/middleware.ts index d78fd44..f1d34c5 100644 --- a/plugins/css_bundler/src/middleware.ts +++ b/plugins/css_bundler/src/middleware.ts @@ -12,8 +12,19 @@ export function cssHandler(sourceDir: string): MiddlewareHandler { if ( ctx.url.pathname.startsWith('/') && ctx.url.pathname.endsWith('.css') ) { + const filename = join(assetDir, ctx.url.pathname) + + if (ctx.url.pathname.endsWith('.map.css')) { + const file = await Deno.readFile(filename) + return new Response(file, { + headers: { + 'Content-Type': 'application/json; charset=utf-8', + }, + }) + } + await bundleCss(sourceDir, assetDir, ctx.url.pathname, ctx.config.dev) - const file = await Deno.readFile(join(assetDir, ctx.url.pathname)) + const file = await Deno.readFile(filename) return new Response(file, { headers: { 'Content-Type': 'text/css; charset=utf-8',