fix: server initialized twice in old dev mode (#1781)
This commit is contained in:
@@ -43,17 +43,16 @@ export async function dev(
|
|||||||
const outDir = join(dir, "_fresh");
|
const outDir = join(dir, "_fresh");
|
||||||
|
|
||||||
const isBuild = Deno.args.includes("build");
|
const isBuild = Deno.args.includes("build");
|
||||||
const ctx = await ServerContext.fromManifest(manifest, {
|
|
||||||
...options,
|
|
||||||
skipSnapshot: true,
|
|
||||||
dev: !isBuild,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isBuild) {
|
if (isBuild) {
|
||||||
// Ensure that build dir is empty
|
// Ensure that build dir is empty
|
||||||
await fs.emptyDir(outDir);
|
await fs.emptyDir(outDir);
|
||||||
await build(join(dir, "fresh.gen.ts"), options ?? {});
|
await build(join(dir, "fresh.gen.ts"), options ?? {});
|
||||||
} else if (options) {
|
} else if (options) {
|
||||||
|
const ctx = await ServerContext.fromManifest(manifest, {
|
||||||
|
...options,
|
||||||
|
skipSnapshot: true,
|
||||||
|
dev: true,
|
||||||
|
});
|
||||||
await startFromContext(ctx, options);
|
await startFromContext(ctx, options);
|
||||||
} else {
|
} else {
|
||||||
// Legacy entry point: Back then `dev.ts` would call `main.ts` but
|
// Legacy entry point: Back then `dev.ts` would call `main.ts` but
|
||||||
|
|||||||
Reference in New Issue
Block a user