Skip to content

Commit

Permalink
fix(nuxt): update payload regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 4, 2024
1 parent 1508fd6 commit 1d78a09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/nuxt/src/core/runtime/nitro/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async function getIslandContext (event: H3Event): Promise<NuxtIslandContext> {
return ctx
}

const PAYLOAD_URL_RE = process.env.NUXT_JSON_PAYLOADS ? /\/_payload(\.[a-zA-Z0-9]+)?.json(\?.*)?$/ : /\/_payload(\.[a-zA-Z0-9]+)?.js(\?.*)?$/
const PAYLOAD_URL_RE = process.env.NUXT_JSON_PAYLOADS ? /\/_payload.json(\?.*)?$/ : /\/_payload.js(\?.*)?$/
const ROOT_NODE_REGEX = new RegExp(`^<${appRootTag}${appRootId ? ` id="${appRootId}"` : ''}>([\\s\\S]*)</${appRootTag}>$`)

const PRERENDER_NO_SSR_ROUTES = new Set(['/index.html', '/200.html', '/404.html'])
Expand Down Expand Up @@ -262,6 +262,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse

// Whether we are rendering payload route
const isRenderingPayload = PAYLOAD_URL_RE.test(url) && !isRenderingIsland
console.log({ isRenderingPayload, url, _url: url.substring(0, url.lastIndexOf('/')) || '/' })
if (isRenderingPayload) {
url = url.substring(0, url.lastIndexOf('/')) || '/'

Expand Down

0 comments on commit 1d78a09

Please sign in to comment.