isaac_way
isaac_way2y ago

"This is likely not portable" error

Randomly started getting this weird error on my front end, can't find anything online on it. Something wrong with my project config, I'm sure It appears on my trpc react but also in some other places:
export const api = createTRPCReact<AppRouter>();
export const api = createTRPCReact<AppRouter>();
Any ideas?
7 Replies
isaac_way
isaac_wayOP2y ago
had composite: true in the tsconfig.json, removing that fixed it idk why
Nick
Nick2y ago
I bet @ixahmedxi can tell us I’ve seen this a lot when the api project has dependencies producing types into the API which aren’t available to the client via node_modules Composite might end up relating to that behaviour
Ahmed Elsakaan
hmm i remember getting this error as well but i completely forgot how i solved it
Nick
Nick2y ago
Using monorepo module hoisting or installing the dep in both projects generally fixes it But there are other magic tsconfig things I’ve seen people do (quite a bit of history in this forum)
isaac_way
isaac_wayOP2y ago
hmm I just disabled hoisting to fix some other issue lol probably what caused it to start happening
Nick
Nick2y ago
You can be more specific in how you disable hoisting, or you can install Prisma into both projects just for the types Or tsconfig tweaks but that seems fragile and might break other stuff too 😅
Assam
Assam12mo ago
I got same issue, but I solved to set 'baseUrl' in tsconfig.json with turborepo / pnpm

Did you find this page helpful?