Hello,
We are migrating away from NextJS due to certain deployment limitations, specifically the lack of canary deployment support caused by server-side actions. As part of this migration, we are rewriting one API call at a time into a NestJS application. So far, we've found NestJS to be a great frameworkโpleasant to work with and intuitive.
However, we've encountered a challenge: sharing our Prisma library between the NestJS and NextJS applications. To address this, we've transitioned to using pnpm workspaces combined with turborepo. While NextJS works out of the box with Just-in-Time (JIT) compilation, NestJS presents a different issue.
The Issue
When transpiling NestJS TypeScript into JavaScript, we need to use the commonjs modules configuration. However, to enable JIT compilation, the module resolution must be set to bundler. Ideally, weโd like to configure pnpm such that both applications can use newer module resolutions (nodenext, preserve, or es2015+) seamlessly.
Question
How can we configure our pnpm monorepo to share the Prisma package between both NextJS and NestJS applications effectively? If you have a solution, could you kindly share an example?