mirror of
https://github.com/youzan/vant.git
synced 2025-10-17 00:14:18 +00:00
fix(cli): improve import regexp
This commit is contained in:
@@ -6,7 +6,7 @@ let depsMap: Record<string, string[]> = {};
|
||||
let existsCache: Record<string, boolean> = {};
|
||||
|
||||
// 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) || [];
|
||||
|
Reference in New Issue
Block a user