Skip to content

Commit 2151b86

Browse files
fix template invocation
1 parent bbd95c1 commit 2151b86

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ export default async function middlewareLoader(this: any) {
3838
middlewareConfig: middlewareConfigBase64,
3939
}: MiddlewareLoaderOptions = this.getOptions()
4040
const matchers = encodedMatchers ? decodeMatchers(encodedMatchers) : undefined
41-
const stringifiedPagePath = stringifyRequest(this, absolutePagePath)
41+
const pagePath = this.utils.contextify(
42+
this.context || this.rootContext,
43+
absolutePagePath
44+
)
45+
4246
const middlewareConfig: MiddlewareConfig = JSON.parse(
4347
Buffer.from(middlewareConfigBase64, 'base64').toString()
4448
)
@@ -57,7 +61,7 @@ export default async function middlewareLoader(this: any) {
5761
}
5862

5963
return await loadEntrypoint('middleware', {
60-
VAR_USERLAND: stringifiedPagePath,
64+
VAR_USERLAND: pagePath,
6165
VAR_DEFINITION_PAGE: page,
6266
})
6367
}

0 commit comments

Comments
 (0)