From 33bdcbc0298df69f342a02c545facbcff58e8067 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 19 Apr 2021 19:13:09 +0800 Subject: [PATCH] fix(cli): ignore import types when analyzing deps (#8574) --- packages/vant-cli/src/compiler/get-deps.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vant-cli/src/compiler/get-deps.ts b/packages/vant-cli/src/compiler/get-deps.ts index 13d1d8848..363ea6118 100644 --- a/packages/vant-cli/src/compiler/get-deps.ts +++ b/packages/vant-cli/src/compiler/get-deps.ts @@ -9,7 +9,8 @@ let existsCache: Record = {}; const IMPORT_RE = /import\s+?(?:(?:(?:[\w*\s{},]*)\s+from(\s+)?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g; function matchImports(code: string): string[] { - return code.match(IMPORT_RE) || []; + const imports = code.match(IMPORT_RE) || []; + return imports.filter((line) => !line.includes('import type')); } function exists(filePath: string) {