diff --git a/packages/docusaurus-theme-classic/package.json b/packages/docusaurus-theme-classic/package.json index 81e7beddb236..2a388a3284a6 100644 --- a/packages/docusaurus-theme-classic/package.json +++ b/packages/docusaurus-theme-classic/package.json @@ -24,9 +24,6 @@ "react": "^16.8.4", "react-dom": "^16.8.4" }, - "bundledDependencies": [ - "@docusaurus/utils" - ], "engines": { "node": ">=10.9.0" } diff --git a/packages/docusaurus-theme-classic/src/theme/DocPage/index.js b/packages/docusaurus-theme-classic/src/theme/DocPage/index.js index 835b5791ae2e..02d38850a752 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocPage/index.js +++ b/packages/docusaurus-theme-classic/src/theme/DocPage/index.js @@ -21,10 +21,10 @@ import styles from './styles.module.css'; function DocPage(props) { const {route: baseRoute, docsMetadata, location} = props; // case-sensitive route such as it is defined in the sidebar - const currentRoute = baseRoute.routes.find(route => - matchPath(location.pathname, route), - ); - + const currentRoute = + baseRoute.routes.find(route => { + return matchPath(location.pathname, route); + }) || {}; const {permalinkToSidebar, docsSidebars, version} = docsMetadata; const sidebar = permalinkToSidebar[currentRoute.path]; const { @@ -33,7 +33,7 @@ function DocPage(props) { } = useDocusaurusContext(); const {sidebarCollapsible = true} = themeConfig; - if (!currentRoute) { + if (Object.keys(currentRoute).length === 0) { return ; } diff --git a/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.js b/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.js index f72126d714ea..a994194366d0 100644 --- a/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.js +++ b/packages/docusaurus-theme-classic/src/theme/DocSidebar/index.js @@ -11,7 +11,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; import useLockBodyScroll from '@theme/hooks/useLockBodyScroll'; import Link from '@docusaurus/Link'; -import isInternalUrl from '@docusaurus/utils'; +import isInternalUrl from '@docusaurus/utils'; // eslint-disable-line import/no-extraneous-dependencies import styles from './styles.module.css';