Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit e44e080

Browse files
committed
Fix routes hmr
1 parent 5774387 commit e44e080

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

commands/dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ if (import.meta.main) {
170170
};
171171
emitter.on("create", updateRoutes);
172172
emitter.on("remove", updateRoutes);
173-
// updateRoutes({});
173+
updateRoutes({});
174174

175175
if (serverEntry) {
176176
emitter.on(`hotUpdate:./${basename(serverEntry)}`, bs);

server/mod.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { serve as stdServe, serveTls } from "https://deno.land/[email protected]/http/
33
import { readableStreamFromReader } from "https://deno.land/[email protected]/streams/conversion.ts";
44
import { VERSION } from "https://deno.land/x/[email protected]/version.ts";
55
import FetchError from "../framework/core/fetch_error.ts";
6+
import type { RouteRecord } from "../framework/core/route.ts";
67
import log, { LevelName } from "../lib/log.ts";
78
import { getContentType } from "../lib/mime.ts";
89
import util from "../lib/util.ts";
@@ -277,7 +278,7 @@ export const serve = (options: ServerOptions = {}) => {
277278
}
278279

279280
// request data
280-
const routes = await routesPromise;
281+
const routes: RouteRecord = Reflect.get(globalThis, "__ALEPH_ROUTES") || await routesPromise;
281282
if (routes.routes.length > 0) {
282283
for (const [pattern, { filename }] of routes.routes) {
283284
const ret = pattern.exec({ host, pathname });

0 commit comments

Comments
 (0)