Skip to content

Commit 6f9e9dd

Browse files
committed
fix matcher when function manifest exist but no node middleware
remove useless function
1 parent 1ea55e7 commit 6f9e9dd

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

packages/open-next/src/core/routing/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export function getMiddlewareMatch(
150150
middlewareManifest: MiddlewareManifest,
151151
functionsManifest?: FunctionsConfigManifest,
152152
) {
153-
if (functionsManifest) {
153+
if (functionsManifest?.functions?.["/_middleware"]) {
154154
return (
155155
functionsManifest.functions["/_middleware"].matchers?.map(
156156
({ regexp }) => new RegExp(regexp),

packages/open-next/src/core/util.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import fs from "node:fs";
2-
import path from "node:path";
3-
41
import {
52
AppPathsManifestKeys,
63
NextConfig,
74
RoutesManifest,
85
} from "config/index.js";
96
// @ts-ignore
107
import NextServer from "next/dist/server/next-server.js";
11-
import type { MiddlewareManifest } from "types/next-types.js";
128

139
import { debug } from "../adapters/logger.js";
1410
import {
@@ -63,18 +59,6 @@ export const requestHandler = new NextServer.default({
6359
dir: __dirname,
6460
}).getRequestHandler();
6561

66-
export function getMiddlewareMatch(middlewareManifest: MiddlewareManifest) {
67-
const rootMiddleware = middlewareManifest.middleware["/"];
68-
if (!rootMiddleware?.matchers) return [];
69-
return rootMiddleware.matchers.map(({ regexp }) => new RegExp(regexp));
70-
}
71-
72-
export function loadMiddlewareManifest(nextDir: string) {
73-
const filePath = path.join(nextDir, "server", "middleware-manifest.json");
74-
const json = fs.readFileSync(filePath, "utf-8");
75-
return JSON.parse(json) as MiddlewareManifest;
76-
}
77-
7862
//#override setNextjsPrebundledReact
7963
export function setNextjsPrebundledReact(rawPath: string) {
8064
// WORKAROUND: Set `__NEXT_PRIVATE_PREBUNDLED_REACT` to use prebundled React

0 commit comments

Comments
 (0)