Skip to content

Commit

Permalink
fix: avoid detecting dynamic import as esm syntax
Browse files Browse the repository at this point in the history
dynamic import() is also valid in cjs contexts
  • Loading branch information
pi0 committed Oct 2, 2021
1 parent 0dfe985 commit 0b904a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function md5 (content: string, len = 8) {
}

export function detectESMSyntax (code: string) {
return code.match(/^\s*import .* from|\s*export |import\s*\(/m)
return code.match(/^\s*import .* from|\s*export .*/m)
}

export function detectLegacySyntax (code: string) {
Expand Down

0 comments on commit 0b904a9

Please sign in to comment.