From a8df616bfda2feb7aa6b738054a02e241d4f276b Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Fri, 13 Sep 2024 08:14:15 +0200 Subject: [PATCH] fix: make internal property non enumerable --- packages/router/src/matcher/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/router/src/matcher/index.ts b/packages/router/src/matcher/index.ts index 71614b9ec..75b6fb0c7 100644 --- a/packages/router/src/matcher/index.ts +++ b/packages/router/src/matcher/index.ts @@ -381,7 +381,7 @@ function paramsFromLocation( export function normalizeRouteRecord( record: RouteRecordRaw ): RouteRecordNormalized { - return { + const normalized: RouteRecordNormalized = { path: record.path, redirect: record.redirect, name: record.name, @@ -400,6 +400,15 @@ export function normalizeRouteRecord( ? record.components || null : record.component && { default: record.component }, } + + // mods contain modules and shouldn't be copied, + // logged or anything. It's just used for internal + // advanced use cases like data loaders + Object.defineProperty(normalized, 'mods', { + value: {}, + }) + + return normalized } /**