From c2a82e723e0ec9d733f653de186c818be321e8b6 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 15 Sep 2023 17:37:48 +0200 Subject: [PATCH] fix: server initialized twice in old dev mode (#1781) --- src/dev/dev_command.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/dev/dev_command.ts b/src/dev/dev_command.ts index 958b3b76..2dd1ee38 100644 --- a/src/dev/dev_command.ts +++ b/src/dev/dev_command.ts @@ -43,17 +43,16 @@ export async function dev( const outDir = join(dir, "_fresh"); const isBuild = Deno.args.includes("build"); - const ctx = await ServerContext.fromManifest(manifest, { - ...options, - skipSnapshot: true, - dev: !isBuild, - }); - if (isBuild) { // Ensure that build dir is empty await fs.emptyDir(outDir); await build(join(dir, "fresh.gen.ts"), options ?? {}); } else if (options) { + const ctx = await ServerContext.fromManifest(manifest, { + ...options, + skipSnapshot: true, + dev: true, + }); await startFromContext(ctx, options); } else { // Legacy entry point: Back then `dev.ts` would call `main.ts` but