feat(nuxt): add `URL` serialiser for dev server logs

This commit is contained in:
Daniel Roe 2024-05-24 12:23:08 +01:00
parent 2440007906
commit a549b46e90
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
2 changed files with 2 additions and 0 deletions

View File

@ -12,6 +12,7 @@ const devRevivers: Record<string, (data: any) => any> = import.meta.server
? {}
: {
VNode: data => h(data.type, data.props),
URL: data => new URL(data),
}
export default defineNuxtPlugin(async (nuxtApp) => {

View File

@ -14,6 +14,7 @@ import { rootDir } from '#internal/dev-server-logs-options'
const devReducers: Record<string, (data: any) => any> = {
VNode: data => isVNode(data) ? { type: data.type, props: data.props } : undefined,
URL: data => data instanceof URL ? data.toString() : undefined,
}
interface NuxtDevAsyncContext {