@@ -3,7 +3,6 @@ import type {
3
3
MiddlewareMatcher ,
4
4
} from '../../analysis/get-page-static-info'
5
5
import { getModuleBuildInfo } from './get-module-build-info'
6
- import { stringifyRequest } from '../stringify-request'
7
6
import { MIDDLEWARE_LOCATION_REGEXP } from '../../../lib/constants'
8
7
import { loadEntrypoint } from '../../load-entrypoint'
9
8
@@ -38,7 +37,11 @@ export default async function middlewareLoader(this: any) {
38
37
middlewareConfig : middlewareConfigBase64 ,
39
38
} : MiddlewareLoaderOptions = this . getOptions ( )
40
39
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
+
42
45
const middlewareConfig : MiddlewareConfig = JSON . parse (
43
46
Buffer . from ( middlewareConfigBase64 , 'base64' ) . toString ( )
44
47
)
@@ -57,7 +60,7 @@ export default async function middlewareLoader(this: any) {
57
60
}
58
61
59
62
return await loadEntrypoint ( 'middleware' , {
60
- VAR_USERLAND : stringifiedPagePath ,
63
+ VAR_USERLAND : pagePath ,
61
64
VAR_DEFINITION_PAGE : page ,
62
65
} )
63
66
}
0 commit comments