Unexpected "export *" warning with Prisma 6.16 in monorepo setup
Hello 👋
I’m working in a monorepo with Prisma (v6.16.0) and since updating, my dev server is spammed with the following warning:
Repository setup
- Monorepo with Turborepo
- Structure :
- schema.prisma (packages/database/prisma/schema.prisma):
- packages/database/index.ts:
- Example usage:
8 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai
is there if you need a quick second opinion.Problem
After running yarn dev inside apps/vdee, I get continuous warnings related to export * from generated/client.js being CommonJS.
Even with moduleFormat = "esm", Prisma still generates generated/client.js as CommonJS.
This makes export * from "./generated/client"; trigger the warning.
What we already tried
1. Switching tsconfig options
• Added verbatimModuleSyntax: false → no effect.
2. Using moduleFormat = "esm" in schema.prisma
• Cleaned node_modules and regenerated client.
• Still seeing client.js in CommonJS format.
3. Restructuring exports
• Tried exporting from ./generated/index-browser, ./generated/library, etc.
• Works partially but still noisy when including ./generated/client
4. Considering manual exports
• Would prefer not to manually re-export >5000 models and enums from our schema
5. Tried both providers
• provider = "prisma-client-js" (default we used so far)
• provider = "prisma-client" (as recommended in release notes for 6.16)
• In both cases, client.js appears CJS.
Questions
- Is generated/client.js expected to still be CommonJS even with moduleFormat = "esm" and provider = "prisma-client"?
- What is the recommended way to re-export a large Prisma Client (with many models/enums) from a custom package in a monorepo without hitting the unexpected export * warnings?
- Should we directly import PrismaClient from generated/client instead of re-exporting it? If so, how should we handle enums/types consistently across server and browser code?
- Is this a known limitation/bug, or should we adjust our monorepo exports pattern?
We’d love guidance on the proper and future-proof way to set up a monorepo with a shared database package, while staying aligned with Prisma 6.16+ (ESM-first direction).
Hey! I've set this up in our monorepo as well, and we're doing a few things differently what you have here.
First, we are using the recommended settings from the recent Prisma blog on the topic:
https://www.prisma.io/blog/rust-free-prisma-orm-is-ready-for-production
More specifically, these options:
I notice you are missing an
output
so I don't think you are in fact using the rust-free implementation. From your writing and snippets it sounds like that is your intention.
The generated folder does not show up unless you specify the output
.
moduleFormat
is a deprecated setting as far as I know. We haven't used it since 6.0.0
.
The second part to this is we created a re-export file for each "namespace" in the generated folder.
Something like:
client.ts
: export * from "../generated/client/client";
enums.ts
: export * from "../generated/client/enums";
And so forth.
Then we expose these 4 files in our package.json
. This means Prisma is free to change their internals, but we've effectively created a facade layer, so we can redirect those exports if the Prisma internals change, without having to change our imports across the monorepo.
So to answer your questions, I'll try to sum it up:
1) No its not supposed to be. I believe your configuration is wrong. Ours runs perfectly well in an ESM application.
2) Not sure what Prisma recommends, but I would personally recommend this facade layer, and re-export each namespace seperately. This will improve tree shaking and thus reduce bundle size and improve IDE performance.
3) Again, I'd recommend exporting the generated client from dedicated export files, from your package. The generated folder should only be visible to your db package.
4) Not as far as I know, I think your implementation is a little off.
Hope this helps 🙏Prisma
Rust-free Prisma ORM is Ready for Production, ORM v16.6.0 & More
The future of Prisma ORM is here: The Rust-free version of Prisma ORM and the ESM-first prisma-client generator are both Generally Available in v6.16.0.
Hello, thank you very much for your answer.
I setup like this
inside
packages/database/prisma/schema.prisma
:
then, yarn db:generate
then I created :
- packages/database/client.ts
-> export * from "./src/generated/prisma/client";
- packages/database/enums.ts
-> export * from "./src/generated/prisma/enums";
- packages/database/browser.ts
-> export * from "./src/generated/prisma/browser";
- packages/database/models.ts
-> export * from "./src/generated/prisma/models";
- packages/database/commonInputTypes.ts
-> export * from "./src/generated/prisma/commonInputTypes";
then inside package.json
:
Then I ran yarn install
Then I ran yarn dev
and faced the warning
There is still an old file that I didn't change, I don't know but maybe it is the one still causing the warning.
It is this file packages/database/index.ts
:
How should I rewrite it ? Should I delete it ?Yeah I think you should not do the * export from Prisma client, but I am not a 100% sure either.
It would likely conflict with the client export.
I know we no longer do any exports from @prisma/client, and only use it to set it up the adapter
Did you set up the adapter as recommended?
About the adapter :
We set it up inside
apps/vdee/lib/db.ts
, I think we do it the recommended way :
The only things I just changed are the import of Client
, PrismaPlanetScale
& PrismaClient
which were previously imported from "database"
.
My packages/database/index.ts
file now looks like this :
I deleted the export of Client
& PrismaPlanetScale
.
I think our Prisma setup now looks closer to what it should look like thanks to your help.
But I struggle replacing the content of packages/database/index.ts
file which contains the export *
that is probably causing the warning.
- if I delete it, "database"
is not found anymore in the code
- I tried to replace the content with
but now I'm getting the error Module not found: Can't resolve './enums.js
inside packages/database/src/generated/prisma/client.ts
If I look inside packages/database/src/generated/prisma/client.ts
I can see import * as $Enums from "./enums.js"
but it should be enums.ts
(packages/database/src/generated/prisma/enums.ts
)
I post that for now, I will keep digging that later. I think there are options to generate .ts files.It seems like you are close. I dont know if you tried, but have you updated to 6.16.2? A few major type issues were fixed in those minor versions, they may help you narrow in the issues too 🙂
I am actually using Prisma version 6.16.2 👍 I said I was using v6.16.0, it was a mistake.
I think I can't import everything
from "database"
right ?
I have to change everywhere inside my code to from "database/client"
, from "database/enums"
, etc...
It would take some time to modify that and change a lot of lines so I want to be sure,
Is it how you do in your code ?