Issue with Prisma export in Turborepo + Express setup

Hey everyone 👋 I'm running into an issue with my Turborepo setup that includes Prisma and Express.js. When I try to start my dev server with npx turbo dev, I get the following error: The requested module does not provide an export named 'prisma' Here’s some context: I have a @repo/db package where my Prisma client is initialized and exported like this:
import { withAccelerate } from "@prisma/extension-accelerate";
import { PrismaClient } from "./generated/prisma/client";

const globalForPrisma = global as unknown as { prisma: PrismaClient };

export const prisma =
globalForPrisma.prisma || new PrismaClient().$extends(withAccelerate());

if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;

export * from "./generated/prisma/client";
import { withAccelerate } from "@prisma/extension-accelerate";
import { PrismaClient } from "./generated/prisma/client";

const globalForPrisma = global as unknown as { prisma: PrismaClient };

export const prisma =
globalForPrisma.prisma || new PrismaClient().$extends(withAccelerate());

if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;

export * from "./generated/prisma/client";
In my Express app (in another package), I import it like this:
import { prisma } from '@repo/db'
import { prisma } from '@repo/db'
The code compiles fine, but when running the dev command through Turborepo, it crashes with that export error. It seems like Turborepo (or maybe Node’s ESM handling) isn’t recognizing the named export from my Prisma module. Has anyone else run into this issue? Any idea if it’s related to module resolution between packages or how ESM/CJS is configured in Turborepo? Thanks in advance 🙏 my repo: https://github.com/SpinBoxx/prisma-monorepo
GitHub
GitHub - SpinBoxx/prisma-monorepo
Contribute to SpinBoxx/prisma-monorepo development by creating an account on GitHub.
3 Replies
Prisma AI Help
Prisma AI Help•4w ago
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
jsuis goastesque
jsuis goastesqueOP•4w ago
No description
Aman
Aman•4w ago
its a very simple fix see packages/database Rename 'ts.config.json' to 'tsconfig.json' You added an extra dot there

Did you find this page helpful?