From 82a51e21591b0a043219bba5b4097457bf7d2834 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Wed, 17 Jan 2024 19:08:54 +0100 Subject: [PATCH] aa --- packages/nextra-theme/src/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/nextra-theme/src/index.tsx b/packages/nextra-theme/src/index.tsx index 5c2f0060ad1f..6762b9d9057a 100644 --- a/packages/nextra-theme/src/index.tsx +++ b/packages/nextra-theme/src/index.tsx @@ -99,9 +99,12 @@ export default function NextraLayout({ children, pageOpts, pageProps }: NextraTh defaultLocale, route: fsPath, }) - for (const item of result.flatDocsDirectories) { - if (!item.route) { - throw new Error(`Route "${item.name}" is not exist. Remove this field from _meta.js file`) + if (typeof window === 'undefined') { + // Execute this check for sidebar links only on server, will be stripped from client build + for (const item of result.flatDocsDirectories) { + if (!item.route) { + throw new Error(`Route "${item.name}" is not exist. Remove this field from _meta.js file`) + } } } return result