-
Notifications
You must be signed in to change notification settings - Fork 105
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
Doesn't work with project reference when same path is configured to difference packages. #153
Comments
I have a similar issue. I use node with ts-node and tsconfig-paths. |
I'm also fighting with this issue and was just about to make a new ticket about it until I saw yours. I had a quick look at the code here and it seems only the first tsconfig.json is loaded from the local package at the registration point. From there, it expects all imports to match those paths, regardless of whether the path exists in another referenced package or not. Would be really nice to have this feature added as it's pretty important for monorepos in my opinion. |
I'm having the same problem, I'm currently using tsc-alias as an alternative. |
Same requirement here. Have a bunch of workspaces, and each has its own It would be great if we could pass some kind of a Something like this maybe: require("tsconfig-paths").register({
tsconfigResolver(file) {
// Return the tsconfig from anywhere based on the `file`
return resolveTsconfigFrom(file);
}
}) I would be willing to work on a PR, but would need a confirmation/directions from the maintainer if he'll be interested in such functionality. Thanks! |
Any updates on fixing this? |
Let's say there is a directory tree like this.
And each file is like these.
There are two different packages
foo
andbar
in monorepo. They use the same path~
internally.Each package is developed by different teams independently. Thus, the consumer(
bar
) doesn't know whether the dependency(foo
) configures~
as its path (And it shouldn't care as well!).So a developer of
bar
runsnpx ts-node -r tsconfig-paths/register src/index.ts
in packages/bar.But it fails with the error message like this.
This happens because two packages use the same path internally.
I expected tsconfig-paths fully respects typescript project reference feature, but it seems not.
How do you think this can be resolved?
Thanks.
The text was updated successfully, but these errors were encountered: