backbone
backbone15mo ago

how to build tRPC and Prisma with express?

I am using TSC as the official docs example does. But when I use paths in tsconfig.json, It does not work because of not transforming paths . Should I add webpack like nestjs doing?
9 Replies
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Nick
Nick15mo ago
How are you building the app? Are you running with ts-node, or using tsc to transpile and then running the output code with node?
Nick
Nick15mo ago
esbuild or some bundle can be a good solution, but might be more complex than supporting paths. This is very useful to just add support for the path mappings at runtime: https://github.com/dividab/tsconfig-paths
GitHub
GitHub - dividab/tsconfig-paths: Load node modules according to tsc...
Load node modules according to tsconfig paths, in run-time or via API. - GitHub - dividab/tsconfig-paths: Load node modules according to tsconfig paths, in run-time or via API.
backbone
backbone15mo ago
Thanks very much, I will try it. Hello, I have solved it through @vercel/ncc which can build node project into one js file . And recommend to you.
Nick
Nick15mo ago
That’s very interesting, they mention something about “binary addons”, does that mean using a native binding like a DB driver will work? Problem I’ve seen with bundlers and NodeJS is they often break these native packages
backbone
backbone15mo ago
ncc will package all your dependency, of course including prisma binary or others. And I also solve prisma binary problem using this amzing tool. I think the subject about build & deploy need add to the official docs.
Nick
Nick15mo ago
Well tRPC is just a NodeJS package, build & deploy are up to whatever repo solution you choose, and it sounds like you’ve personally gone for something quite home-rolled Might be one to provide a simple solution for in the QuickStart guide though, I’m currently having a think on that as it’s lacking in many areas
backbone
backbone15mo ago
ok, I am glad to show some code,if it could help you a little.❤️
Nick
Nick15mo ago
If there's anything you would advocate for then please do pop it here: https://github.com/trpc/trpc/issues/3947
GitHub
docs: enhance quickstart guide · Issue #3947 · trpc/trpc
Area of Improvement The quickstart guide could use some detail in a number of areas which aren't mentioned yet, and to go deeper in some existing areas. I plan on on contributing this. Gett...