diff --git a/lib/middleware/serveStatic.ts b/lib/middleware/serveStatic.ts index 0db276f9..596cd22c 100644 --- a/lib/middleware/serveStatic.ts +++ b/lib/middleware/serveStatic.ts @@ -56,6 +56,17 @@ export const serveStatic = (options: ServeStaticOptions = { root: "" }) => { return; } catch (_error) { + + + if (path.match("\.map$")) { + log.debug(`Static file: ${path} does not exist, returning 404`); + + return new Response( + null, + { status: 404 }, + ); + } + /** * This is so we can just continue the request if the above fetch fails, * since the static asset might not exist, and we want to avoid Deno APIs @@ -65,13 +76,6 @@ export const serveStatic = (options: ServeStaticOptions = { root: "" }) => { */ log.debug(`Static file: ${path} does not exist, continuing`); - if (path.match("\.map$")) { - return new Response( - null, - { status: 404 }, - ); - } - await next(); } };