From 764e9e2d69749c26de16ec13c835f34c17c83ad5 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Thu, 3 Dec 2020 16:08:11 +0800 Subject: [PATCH] fix(cli): improve import regexp --- packages/vant-cli/src/compiler/get-deps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vant-cli/src/compiler/get-deps.ts b/packages/vant-cli/src/compiler/get-deps.ts index 3b49d9e87..367c3f951 100644 --- a/packages/vant-cli/src/compiler/get-deps.ts +++ b/packages/vant-cli/src/compiler/get-deps.ts @@ -6,7 +6,7 @@ let depsMap: Record = {}; let existsCache: Record = {}; // https://regexr.com/47jlq -const IMPORT_RE = /import\s+?(?:(?:(?:[\w*\s{},]*)\s+from\s+?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g; +const IMPORT_RE = /import\s+?(?:(?:(?:[\w*\s{},]*)\s+from(\s+)?)|)(?:(?:".*?")|(?:'.*?'))[\s]*?(?:;|$|)/g; function matchImports(code: string): string[] { return code.match(IMPORT_RE) || [];