Skip to content

Commit

Permalink
fix template invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Oct 13, 2023
1 parent bbd95c1 commit be66716
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {
MiddlewareMatcher,
} from '../../analysis/get-page-static-info'
import { getModuleBuildInfo } from './get-module-build-info'
import { stringifyRequest } from '../stringify-request'
import { MIDDLEWARE_LOCATION_REGEXP } from '../../../lib/constants'
import { loadEntrypoint } from '../../load-entrypoint'

Expand Down Expand Up @@ -38,7 +37,11 @@ export default async function middlewareLoader(this: any) {
middlewareConfig: middlewareConfigBase64,
}: MiddlewareLoaderOptions = this.getOptions()
const matchers = encodedMatchers ? decodeMatchers(encodedMatchers) : undefined
const stringifiedPagePath = stringifyRequest(this, absolutePagePath)
const pagePath = this.utils.contextify(
this.context || this.rootContext,
absolutePagePath
)

const middlewareConfig: MiddlewareConfig = JSON.parse(
Buffer.from(middlewareConfigBase64, 'base64').toString()
)
Expand All @@ -57,7 +60,7 @@ export default async function middlewareLoader(this: any) {
}

return await loadEntrypoint('middleware', {
VAR_USERLAND: stringifiedPagePath,
VAR_USERLAND: pagePath,
VAR_DEFINITION_PAGE: page,
})
}

0 comments on commit be66716

Please sign in to comment.