Open llamadeus opened 5 years ago
I'm away this week, so can give you an abbreviated answer. typhonjs-escomplex
has no idea about dependency resolvers. Look an ImportDeclaration(settings)
in this file and see that you can provide a dependencyResolver
function to modify things here. This needs to have examples in the forthcoming documentation.
Thanks for your explanation. I understand that it's not really possible to resolve aliases, because they depend on the webpack config. Also, there can be multiple different webpack configs, having different aliases (which wouldn't make too much sense).
The only two options I see here would be a heuristic approach, which assumes, aliases should resolve to a file in the project folder, and therefore tries to figure out the alias itself. The second approach would need the webpack config itself to extract the alias key. Both not 100% satisfying as they have their pros and cons.
I'm willing to invest some time to write a plugin which helps resolving dependencies, but I'd like to discuss first, which approach is the more promising.
The
adjacencyList
key does not contain all adjacencies for projects which use webpack aliases to resolve files from another path.Given the following webpack config:
And the following file
src/js/app.js
:The adjacency will not be discovered. However, the dependency is listed correctly.