Issues with Prisma in Turborepo
I'm essentially generating the client and compiling a commonjs version so that i can use my Prisma client across our monorepo. this works, however, when i try to extend the client to use extensions, it breaks with the following error:
I've been at this for a day now, and I'm slowly losing my sanity with this. I don't understand why extending the client would break it. I tried looking for flags to include extensions in the generated client but couldn't find anything.
The issue is that I need to use Prisma in both NextJS (EsNext) and NestJS (CommonJS) - which means I need both esm and cjs support for the exported clients.

3 Replies
You selected the carefully hand-crafted route. A dev artisan will respond soon. Meanwhile, the
#ask-ai
channel awaits if you're curious!Without extending the client, it works as expected.

I am willing to compromise as long as I can have a unified Prisma schema. Might be better to import the clients from
@prisma/client
in each app separately. But would this carry over the type safety?
Would really appreciate some insight. I can provide repo access as well if needed.
It seems moving extension exports from the shared @workspace/prisma
package and manually importing from the extension packages solved the issue. I also had to modify my tsconfig.json
for my NestJS project:
Solution Approach
Configuration Changes
1. Package Configuration (package.json
for @workspace/prisma
):
2. TypeScript Configuration (tsconfig.json
for NestJS):
3. SWC Configuration (.swcrc
):
Key Resolution Steps
- Move extension exports from the shared package to individual app packages
- Manually import from extension packages
- Ensure separate client imports for each runtime environment
Turborepo Configuration (turbo.json
):
This approach allows for a unified Prisma schema while maintaining type safety and runtime compatibility across different project environments.