Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

This does not work with eval("require('package-name')") #66

Closed
ehmicky opened this issue Nov 4, 2019 · 1 comment
Closed

This does not work with eval("require('package-name')") #66

ehmicky opened this issue Nov 4, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Nov 4, 2019

See #16 (comment) (comment by @jon301).

Dependencies crawling works with:

const package = require('package-name')

But not with:

const package = eval(`require('package-name')`)

This is because our crawling is doing JavaScript AST parsing and is looking for function calls require(), but does not look inside strings.

Looking inside strings would be quite complicated. Also I don't really see why one would want to wrap require() in eval() here since eval() inherits the current context.

However it turns out this specific project is actually doing just that.

I've opened an issue here for this specific library.

@ehmicky
Copy link
Contributor Author

ehmicky commented Nov 5, 2019

Closed in favor of #68.

@ehmicky ehmicky closed this as completed Nov 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant