TSConfig Path Alias doesn't resolve in monorepo
Trying to convert my repo to a turborepo, using create-t3-turbo as a baseline. Almost everything worked as expected, until I tried to add custom path aliases inside
packages/api
. That led to the following error.
This is my tsconfig.json
for the packages/api
package:
The compilerOptions
match apps/web
exactly, but while it works in apps/web
it very much does not work in packages/api
.6 Replies
It seems Next.js is unable to reconcile the different mappings in different packages?
I experienced a similar issue, I've only been able to use path aliases in nextjs app, not in a nodejs one nor a package
Yeah that's where I'm at as well
I actually did this on the a nodejs app -
it's not pretty, but does the job - for some reason i couldnt use ~ symbol there, but hashsign works
didnt try with @ tbh, i dont like it lol
interesting, let me give that a shot
hm doesn't seem to be working atm, I think I'm gonna take a break for now tbh been a long day lol
Imo it’s not worth using path aliases in a monorepo - they’re going to break more than they’re worth
You can use my repo as a reference for how to implement them
https://github.com/AnswerOverflow/AnswerOverflow
I made one base.json tsconfig that has every path alias and then extend from that https://github.com/AnswerOverflow/AnswerOverflow/blob/main/packages/config/tsconfig/base.json
It’s ugly and hacky but it works
GitHub
GitHub - AnswerOverflow/AnswerOverflow: Indexing Discord Help Chann...
Indexing Discord Help Channel Questions into Google - GitHub - AnswerOverflow/AnswerOverflow: Indexing Discord Help Channel Questions into Google
GitHub
AnswerOverflow/base.json at main · AnswerOverflow/AnswerOverflow
Indexing Discord Help Channel Questions into Google - AnswerOverflow/base.json at main · AnswerOverflow/AnswerOverflow