Skip to content

Commit 959990a

Browse files
committed
Fix createRoutes calls.
1 parent c749b4b commit 959990a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/remix/src/utils/serverAdapters/express.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ function wrapExpressRequestHandler(
2424
): ExpressRequestHandler {
2525
let routes: ServerRoute[];
2626

27-
if (build && 'routes' in build) {
28-
routes = createRoutes(build.routes);
29-
}
30-
3127
return async function (
3228
this: unknown,
3329
req: ExpressRequest,
@@ -52,7 +48,7 @@ function wrapExpressRequestHandler(
5248
const url = new URL(request.url);
5349

5450
// This is only meant to be used on development servers, so we don't need to worry about performance here
55-
if (!routes && typeof build === 'function') {
51+
if (build && typeof build === 'function') {
5652
const resolvedBuild = build();
5753

5854
if (resolvedBuild instanceof Promise) {
@@ -61,6 +57,8 @@ function wrapExpressRequestHandler(
6157
} else {
6258
routes = createRoutes(resolvedBuild.routes);
6359
}
60+
} else {
61+
routes = createRoutes(build.routes);
6462
}
6563

6664
const [name, source] = getTransactionName(routes, url);

0 commit comments

Comments
 (0)