-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Is it possible to configure baseUrl and still use relative path when doing autocomplete? #36181
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
Comments
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
i second that. having the same issue. this is a bug |
You can suppress auto imports from using the unrooted path with a VS Code setting: But TypeScript will still believe that |
Uhmmm, you really cannot use the relative value in a monorepo project. If that relativity only worked up to the nearest tsconfig file, maybe, but it isn't feasible to use it if it adds an import of a sibling lib's module as a relative import. |
FWIW, monorepos with project references work really well with lerna and/or yarn workspaces, and don’t require path mappings / baseUrl that way. Out of curiosity, how do you test/run the projects in your monorepo? That is, during development, what mechanism makes |
EDIT: since TS v4.1
baseUrl
is not longer required to use with thepaths
rule, fixing this issue!TypeScript Version: 3.7.4
Search Terms: baseUrl, autocomplete, relative path, lib, aliases, monorepo, sibling libs
Code
tsconfig.json
Expected behavior: I have a monorepo with some libs and some of them uses code from sibling libs. I achieved three things I wanted: (1) to not need to build them just for TS to correctly check the imports (thanks to
baseUrl/paths
config), (2) to jump into the actual definition instead of the built file (also thanks tobaseUrl/paths
), (3) to TS understand the relationship between these libs (although I don't know if I configured everything correctly).The thing is, since I'm using the
baseUrl
config, any module I try to import from within the same library, but at least two folders up above the actual module will use the alias. E.g.:The problem with the alias for files withing the same lib is exactly that: they are libraries, so what I build with TS is what I publish to my private repository manager. When some service import the file with the alises it will crash because it won't understand it.
Is correct what I'm configuring/want to have?
Thank you in advance!
The text was updated successfully, but these errors were encountered: