diff --git a/packages/nuxt/src/pages/utils.ts b/packages/nuxt/src/pages/utils.ts index 94dcf70e21..f24ba65aa5 100644 --- a/packages/nuxt/src/pages/utils.ts +++ b/packages/nuxt/src/pages/utils.ts @@ -303,11 +303,12 @@ export function normalizeRoutes (routes: NuxtPage[], metaImports: Set = return { imports: metaImports, routes: genArrayFromRaw(routes.map((page) => { - const route = Object.fromEntries( - Object.entries(page) - .filter(([key, value]) => key !== 'file' && (Array.isArray(value) ? value.length : value)) - .map(([key, value]) => [key, JSON.stringify(value)]) - ) as Record, string> & { component?: string } + const route: Record, string> & { component?: string } = Object.create(null) + for (const [key, value] of Object.entries(page)) { + if (key !== 'file' && (Array.isArray(value) ? value.length : value)) { + route[key as Exclude] = JSON.stringify(value) + } + } if (page.children?.length) { route.children = normalizeRoutes(page.children, metaImports).routes