diff --git a/lib/middleware/compiler.ts b/lib/middleware/compiler.ts index 79e2bb55..cdad496e 100644 --- a/lib/middleware/compiler.ts +++ b/lib/middleware/compiler.ts @@ -4,8 +4,6 @@ import { extname, join, sprintf, toFileUrl } from "../deps.ts"; import { log } from "../logger.ts"; import type { CompilerOptions, Context, Next } from "../types.ts"; -const { transform } = await createCompiler(); - export const compiler = (options: CompilerOptions) => { const { root, @@ -13,6 +11,8 @@ export const compiler = (options: CompilerOptions) => { } = options; return async (context: Context, next: Next) => { + const { transform } = await createCompiler(); + const method = context.req.method; const requestPathname = decodeURIComponent( new URL(context.req.url).pathname, diff --git a/lib/server.ts b/lib/server.ts index 07fc1df6..aa4a6dff 100644 --- a/lib/server.ts +++ b/lib/server.ts @@ -1,7 +1,6 @@ import { ULTRA_COMPILER_PATH } from "./constants.ts"; import { assert, dotenv, Hono, resolve, toFileUrl } from "./deps.ts"; import { ensureMinDenoVersion } from "./dev/ensureMinDenoVersion.ts"; -import { log } from "./logger.ts"; import { serveStatic } from "./middleware/serveStatic.ts"; import { CreateServerOptions, Env, Mode } from "./types.ts"; import { UltraServer } from "./ultra.ts"; @@ -91,7 +90,6 @@ export async function createServer< })); if (mode === "development") { - log.info("Loading compiler"); const { compiler } = await import("./middleware/compiler.ts"); // deno-fmt-ignore