fix: plugins not loaded with legacy dev (#1764)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
42dc54500c
commit
ec2f785455
@@ -12,15 +12,13 @@ import { startFromContext } from "../server/boot.ts";
|
||||
export async function dev(
|
||||
base: string,
|
||||
entrypoint: string,
|
||||
options: FreshOptions = {},
|
||||
options?: FreshOptions,
|
||||
) {
|
||||
ensureMinDenoVersion();
|
||||
|
||||
// Run update check in background
|
||||
updateCheck(DAY).catch(() => {});
|
||||
|
||||
entrypoint = new URL(entrypoint, base).href;
|
||||
|
||||
const dir = dirname(fromFileUrl(base));
|
||||
|
||||
let currentManifest: Manifest;
|
||||
@@ -54,13 +52,15 @@ export async function dev(
|
||||
if (isBuild) {
|
||||
// Ensure that build dir is empty
|
||||
await fs.emptyDir(outDir);
|
||||
await build(join(dir, "fresh.gen.ts"), options);
|
||||
await build(join(dir, "fresh.gen.ts"), options ?? {});
|
||||
} else if (options) {
|
||||
await startFromContext(ctx, options);
|
||||
} else {
|
||||
// Legacy entry point: Back then `dev.ts` would call `main.ts` but
|
||||
// this causes duplicate plugin instantiation if both `dev.ts` and
|
||||
// `main.ts` instantiate plugins.
|
||||
Deno.env.set("__FRSH_LEGACY_DEV", "true");
|
||||
entrypoint = new URL(entrypoint, base).href;
|
||||
await import(entrypoint);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user