fix(nuxt): fix replace regex used for slots in islands SSR (#24255)

This commit is contained in:
Julien Huang 2023-11-13 08:29:44 +01:00 committed by GitHub
parent c1ddb359e3
commit bd32ccd2d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -584,7 +584,7 @@ function replaceServerOnlyComponentsSlots (ssrContext: NuxtSSRContext, html: str
if (!match) { continue }
const [, uid, slot] = match
if (!uid || !slot) { continue }
html = html.replace(new RegExp(`<div nuxt-ssr-component-uid="${uid}"[^>]*>((?!nuxt-ssr-slot-name="${slot}"|nuxt-ssr-component-uid)[\\s\\S])*<div [^>]*nuxt-ssr-slot-name="${slot}"[^>]*>`), (full) => {
html = html.replace(new RegExp(`<div [^>]*nuxt-ssr-component-uid="${uid}"[^>]*>((?!nuxt-ssr-slot-name="${slot}"|nuxt-ssr-component-uid)[\\s\\S])*<div [^>]*nuxt-ssr-slot-name="${slot}"[^>]*>`), (full) => {
return full + teleports[key]
})
}