From 687d875e4137d96acf5bda189033e3b6b7af9311 Mon Sep 17 00:00:00 2001 From: the1812 Date: Tue, 4 Jan 2022 09:01:42 +0800 Subject: [PATCH] Detect undefined component --- src/core/settings/helpers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/settings/helpers.ts b/src/core/settings/helpers.ts index 75da27cf0..8b3d4e1f3 100644 --- a/src/core/settings/helpers.ts +++ b/src/core/settings/helpers.ts @@ -82,6 +82,10 @@ export const isComponentEnabled = (component: ComponentMetadata | string) => { if (typeof component === 'string') { component = componentsMap[component] } + // 不存在 / 未安装的组件 + if (!component) { + return false + } // 若指定了排除URL, 任意URL匹配就不加载 if (component.urlExclude && component.urlExclude.some(matchUrlPattern)) { return false