fix: disable source map bundle

This commit is contained in:
Julien Oculi 2024-02-05 16:05:36 +01:00
parent eff591b427
commit 342c724dda

View file

@ -12,8 +12,19 @@ export function cssHandler(sourceDir: string): MiddlewareHandler {
if ( if (
ctx.url.pathname.startsWith('/') && ctx.url.pathname.endsWith('.css') 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) 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, { return new Response(file, {
headers: { headers: {
'Content-Type': 'text/css; charset=utf-8', 'Content-Type': 'text/css; charset=utf-8',