Skip to content

Commit 1abc97b

Browse files
authored
fix: reset lastIndex for regex (#320)
1 parent fb50689 commit 1abc97b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/features/external.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export function ExternalPlugin(options: ResolvedOptions): Plugin {
2222
const noExternalPatterns = toArray(noExternal)
2323
if (
2424
noExternalPatterns.some((pattern) => {
25-
return pattern instanceof RegExp ? pattern.test(id) : id === pattern
25+
if (pattern instanceof RegExp) {
26+
pattern.lastIndex = 0
27+
return pattern.test(id)
28+
}
29+
return id === pattern
2630
})
2731
)
2832
return

0 commit comments

Comments
 (0)