How should frontend import AppType (RPC) from backend without extra dependencies
❗unsolved
Good day to the team.
I am currently running a pnpm monorepo with a web package and an API package. Web package is a standard react SPA. API package is Hono with the node adapter, and some node dependencies. Our objective is for the web app to use the RPC client for type safe coms with the backend endpoints.
Currently, we are running into problems because when we try to build frontend, it seems to try to add every single backend dependency into it, when it should probably not be taking code into the final build, even if all that is being exported is the
AppType
AppType
.
My guess is a bad configuration here that doesn't let frontend know to only take types into account when importing from the API package. I know some recommendations are for usage directly through the tsconfig paths, but I wanted to know if there was a manner more akin to monorepo structure with npm packages in mind.
I read from an issue similar in the past like this, and that a solution involved importing only the
.d.ts
.d.ts
, but some more context would be appreciated. Thank you!