Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right, so this is becoming a longer story then I initially thought :)
I actually found a proper way to reproduce the issue reported in the webpack plugin: dividab/tsconfig-paths-webpack-plugin#11 you can find it in my own fork. Basically the problem is that if you let the final resolution be a node_module (which was also the case in that issue) the recursion wasn't handled properly.
It took me a while to actually figure out why this was happening but it ended up being an implicit fallthrough that would basically keep the recursion going. I've put a comment in the code to explain it explicitly.
When I fixed this up, the example I made where I experienced the same error as the issue in the webpack plugin also disapeared.
If you'd like the updated example from my fork for future reference and testing, I'm happy to add it as a PR there.
TL;DR: async code with callbacks is hard :)