Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate middlewareManifestPath only once #55489

Merged
merged 3 commits into from
Sep 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/next/src/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function getMiddlewareMatcher(
}

export default class NextNodeServer extends BaseServer {
protected middlewareManifestPath: string
private _serverDistDir: string | undefined
private imageResponseCache?: ResponseCache
protected renderWorkersPromises?: Promise<void>
Expand Down Expand Up @@ -231,6 +232,8 @@ export default class NextNodeServer extends BaseServer {
const { interceptTestApis } = require('../experimental/testmode/server')
interceptTestApis()
}

this.middlewareManifestPath = join(this.serverDistDir, MIDDLEWARE_MANIFEST)
}

protected async handleUpgrade(): Promise<void> {
Expand Down Expand Up @@ -1335,10 +1338,7 @@ export default class NextNodeServer extends BaseServer {

protected getMiddlewareManifest(): MiddlewareManifest | null {
if (this.minimalMode) return null
const manifest: MiddlewareManifest = require(join(
this.serverDistDir,
MIDDLEWARE_MANIFEST
))
const manifest: MiddlewareManifest = require(this.middlewareManifestPath)
return manifest
}

Expand Down
Loading