Can't build NextJS with TRPC vanilla client.
My mono-repo contains 3 apps and one packages as under.
I imported the trpc server from the client, the types resolve well in the text editor, but when I built I got the type error like this.
This is tsconfig.json of the client. Is there anything wrong?
3 Replies
And this is the tsconfig.json of the server.
I've had similar issues before and it has to do with path aliases in the tsconfig.
I think what's happening is that nextjs tries to resolve
@/collections
inside of the client
app folder and not inside the server
folder.
Unfortunately I don't have a solution for you, since I work around that by avoiding aliases in my trpc routers, though I agree using path aliases is way cleaner for imports.Yes bro. Currently I fix that by removing type checking in the nextjs production build. I should remove path alias as you suggest as well.