Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module Resolution Issues Across Multiple Workspaces with TSConfig Paths #610

Closed
dbudzins opened this issue Apr 29, 2024 · 0 comments · Fixed by #611
Closed

Module Resolution Issues Across Multiple Workspaces with TSConfig Paths #610

dbudzins opened this issue Apr 29, 2024 · 0 comments · Fixed by #611
Labels
bug Something isn't working

Comments

@dbudzins
Copy link
Contributor

It seems that there are potential problems with complex monorepos with each workspace using tsconfig paths or baseurl. If workspace A imports from workspaces B and both workspaces use tsconfig paths, then knip will split the workspaces into 2 different principals. However, when Principal A analyzes workspace A, it will also analyze the imported file from workspace B. Unfortunately, it tries to analyze the file from workspace B using the config options from workspace A, so the bare imports that rely on paths or baseurl end up being reported as unlisted. Furthermore, because the resolution gets cached, even attempts to reanalyze the file as part of Workspace B doesn't fix the problem, so I don't think it can be solved reliably with knip config settings.

This behavior depends on the workspace ordering, so it doesn't reproduce in all circumstances. Some monorepos might just work from pure luck. However, I was able to create a simple repro here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant