fix: prevent reading non existing file
This commit is contained in:
parent
fe316e9dcb
commit
eff591b427
|
@ -12,7 +12,7 @@ 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')
|
||||||
) {
|
) {
|
||||||
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(join(assetDir, ctx.url.pathname))
|
||||||
return new Response(file, {
|
return new Response(file, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
Loading…
Reference in a new issue