fix: middleware default export ignored (#2680)
Fixes https://github.com/denoland/fresh/issues/2657
This commit is contained in:
@@ -142,13 +142,15 @@ export async function fsRoutes<State>(
|
||||
routePath.slice(0, routePath.lastIndexOf("."))
|
||||
}`;
|
||||
const base = normalizedPath.slice(0, normalizedPath.lastIndexOf("/"));
|
||||
const isMiddleware = normalizedPath.endsWith("/_middleware");
|
||||
return {
|
||||
path: normalizedPath,
|
||||
filePath: routePath,
|
||||
base,
|
||||
handlers: mod.handlers ?? mod.handler ?? null,
|
||||
handlers: mod.handlers ?? mod.handler ??
|
||||
(isMiddleware ? mod.default ?? null : null),
|
||||
config: mod.config ?? null,
|
||||
component: mod.default ?? null,
|
||||
component: isMiddleware ? null : mod.default ?? null,
|
||||
} as InternalRoute<State>;
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user