|
|
|
|
|
by concise_unicorn
3598 days ago
|
|
Regular expressions are a very naive way of detecting calls to 'require'. For correctness you're better off recursively walking the AST. I've successfully used Detective in a couple of my personal projects to find all require statements. Relevant issue on Detective:
https://github.com/substack/node-detective/issues/8 |
|
So i wouldn't call regex a 'very naive' choice, since people making it are aware of tradeoffs and pick regex intentionally.