File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/nuxt/src/app/plugins Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,11 @@ export default defineNuxtPlugin((nuxtApp) => {
37
37
nuxtApp . hook ( 'dev:ssr-logs' , ( logs ) => {
38
38
for ( const log of logs ) {
39
39
// deduplicate so we don't print out things that are logged on client
40
- if ( ! hydrationLogs . size || ! hydrationLogs . has ( JSON . stringify ( log . args ) ) ) {
40
+ try {
41
+ if ( ! hydrationLogs . size || ! hydrationLogs . has ( JSON . stringify ( log . args ) ) ) {
42
+ logger . log ( normalizeServerLog ( { ...log } ) )
43
+ }
44
+ } catch {
41
45
logger . log ( normalizeServerLog ( { ...log } ) )
42
46
}
43
47
}
@@ -50,7 +54,8 @@ export default defineNuxtPlugin((nuxtApp) => {
50
54
// pass SSR logs after hydration
51
55
nuxtApp . hooks . hook ( 'app:suspense:resolve' , async ( ) => {
52
56
if ( typeof window !== 'undefined' ) {
53
- const logs = parse ( document . getElementById ( '__NUXT_LOGS__' ) ?. textContent || '[]' , nuxtApp . _payloadRevivers ) as LogObject [ ]
57
+ const content = document . getElementById ( '__NUXT_LOGS__' ) ?. textContent
58
+ const logs = content ? parse ( content , nuxtApp . _payloadRevivers ) as LogObject [ ] : [ ]
54
59
await nuxtApp . hooks . callHook ( 'dev:ssr-logs' , logs )
55
60
}
56
61
} )
You can’t perform that action at this time.
0 commit comments