Skip to content

Commit be66716

Browse files
fix template invocation
1 parent bbd95c1 commit be66716

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/next/src/build/webpack/loaders/next-middleware-loader.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type {
33
MiddlewareMatcher,
44
} from '../../analysis/get-page-static-info'
55
import { getModuleBuildInfo } from './get-module-build-info'
6-
import { stringifyRequest } from '../stringify-request'
76
import { MIDDLEWARE_LOCATION_REGEXP } from '../../../lib/constants'
87
import { loadEntrypoint } from '../../load-entrypoint'
98

@@ -38,7 +37,11 @@ export default async function middlewareLoader(this: any) {
3837
middlewareConfig: middlewareConfigBase64,
3938
}: MiddlewareLoaderOptions = this.getOptions()
4039
const matchers = encodedMatchers ? decodeMatchers(encodedMatchers) : undefined
41-
const stringifiedPagePath = stringifyRequest(this, absolutePagePath)
40+
const pagePath = this.utils.contextify(
41+
this.context || this.rootContext,
42+
absolutePagePath
43+
)
44+
4245
const middlewareConfig: MiddlewareConfig = JSON.parse(
4346
Buffer.from(middlewareConfigBase64, 'base64').toString()
4447
)
@@ -57,7 +60,7 @@ export default async function middlewareLoader(this: any) {
5760
}
5861

5962
return await loadEntrypoint('middleware', {
60-
VAR_USERLAND: stringifiedPagePath,
63+
VAR_USERLAND: pagePath,
6164
VAR_DEFINITION_PAGE: page,
6265
})
6366
}

0 commit comments

Comments
 (0)