Skip to content

Commit 4370751

Browse files
committed
Improve the regex for detecting es modules
1 parent 18fcb66 commit 4370751

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default function isESModule(code: string) {
2-
return /^(import|export)\s/gm.test(code);
2+
return /(;|^)(import|export)(\s|{)/gm.test(code);
33
}

0 commit comments

Comments
 (0)