Skip to content

How to use path alias in packages? #132

Answered by PhilDL
depsimon asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for the repro, the solution my solution is still the same as describe above:

Update the apps/web/tsconfig.json paths:

    "paths": {
      "~/*": ["./app/*", "../../packages/ui/src/*"],
      "@monorepo/ui/*": ["../../packages/ui/src/*"]
    },

Without "../../packages/ui/src/*" in the ~/* your alias in UI package won't work.

I personally find this setup confusing when same aliases are merging, and would advise you, if alias are really important to you, to maybe create a root tsconfig file and write your paths there, the other packages/apps then extend that root tsconfig.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by depsimon
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #128 on February 28, 2024 14:16.