Skip to content

Commit

Permalink
fix: prevent more false positives on cjs (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 28, 2021
1 parent d3ecbe9 commit 8ac4b74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/syntax.ts
Expand Up @@ -11,7 +11,7 @@ export function hasESMSyntax (code: string): boolean {
return ESM_RE.test(code)
}

const CJS_RE = /([\s;]|^)(module.exports\b|exports\.|require\s*\(|global\b)/m
const CJS_RE = /([\s;]|^)(module.exports\b|exports\.\w|require\s*\(|global\.\w)/m
export function hasCJSSyntax (code: string): boolean {
return CJS_RE.test(code)
}
Expand Down

0 comments on commit 8ac4b74

Please sign in to comment.