Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): respect baseURL when rendering payload path (#7809)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Sep 26, 2022
1 parent a68a7fe commit c0e99c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default defineRenderHandler(async (event) => {

// Whether we are prerendering route
const _PAYLOAD_EXTRACTION = process.env.prerender && process.env.NUXT_PAYLOAD_EXTRACTION && !ssrContext.noSSR
const payloadURL = _PAYLOAD_EXTRACTION ? joinURL(url, '_payload.js') : undefined
const payloadURL = _PAYLOAD_EXTRACTION ? joinURL(useRuntimeConfig().app.baseURL, url, '_payload.js') : undefined
if (process.env.prerender) {
ssrContext.payload.prerenderedAt = Date.now()
}
Expand Down Expand Up @@ -177,7 +177,7 @@ export default defineRenderHandler(async (event) => {

if (_PAYLOAD_EXTRACTION) {
// Hint nitro to prerender payload for this route
appendHeader(event, 'x-nitro-prerender', payloadURL!)
appendHeader(event, 'x-nitro-prerender', joinURL(url, '_payload.js'))
// Use same ssr context to generate payload for this route
PAYLOAD_CACHE!.set(url, renderPayloadResponse(ssrContext))
}
Expand Down

0 comments on commit c0e99c7

Please sign in to comment.