fix(nuxt): fix ssr log querySelector (#28864)

This commit is contained in:
Julien Huang 2024-09-06 08:53:57 +02:00 committed by GitHub
parent 8880cb25ef
commit c5f3292d63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
} }
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
const nuxtLogsElement = document.querySelector(`[data-nuxt-logs="${nuxtApp._name}"]`) const nuxtLogsElement = document.querySelector(`[data-nuxt-logs="${nuxtApp._id}"]`)
const content = nuxtLogsElement?.textContent const content = nuxtLogsElement?.textContent
const logs = content ? parse(content, { ...devRevivers, ...nuxtApp._payloadRevivers }) as LogObject[] : [] const logs = content ? parse(content, { ...devRevivers, ...nuxtApp._payloadRevivers }) as LogObject[] : []
await nuxtApp.hooks.callHook('dev:ssr-logs', logs) await nuxtApp.hooks.callHook('dev:ssr-logs', logs)