P
Prisma3mo ago
Satont

With new `prisma-client` prisma client not included in package.json in final nx build.

When i migrated to the new prisma-client generator, my prisma dependency not included in final nx build of app. My project done in way: 1. libs/database with schema and database logic, with prisma schema setted as:
generator client {
provider = "prisma-client"
output = "../../../../prisma-client-backend/src/generated"
previewFeatures = ["metrics", "tracing"]
engineType = "client"
runtime = "nodejs"
moduleFormat = "cjs"
generator client {
provider = "prisma-client"
output = "../../../../prisma-client-backend/src/generated"
previewFeatures = ["metrics", "tracing"]
engineType = "client"
runtime = "nodejs"
moduleFormat = "cjs"
2. libs/prisma-client-backend with just outputed client. 3. in my root package.json i have all needed prisma deps:
"@prisma/adapter-mariadb": "6.16.1",
"@prisma/client": "6.16.1",
"@prisma/instrumentation": "6.16.1",
"prisma": "6.16.1",
"@prisma/adapter-mariadb": "6.16.1",
"@prisma/client": "6.16.1",
"@prisma/instrumentation": "6.16.1",
"prisma": "6.16.1",
But when i'm doing yarn nx build appname, then in ./dist/apps/appname package json contains only
"@prisma/adapter-mariadb": "6.16.1",
"@prisma/instrumentation": "6.16.1",
"@prisma/adapter-mariadb": "6.16.1",
"@prisma/instrumentation": "6.16.1",
3 Replies
Prisma AI Help
Prisma AI Help3mo ago
You selected the bot's instantaneous insights. Let me compile your answer right away! With the new prisma-client generator, Prisma Client is generated into a custom directory you specify via the output field, and you import it directly from that path (e.g., import { PrismaClient } from "prisma-client-backend/src/generated/client.js"). The generated client is not tied to the @prisma/client npm package anymore, so you do not need @prisma/client as a runtime dependency in your app's package.json—only the generated files matter at runtime. The prisma package is only needed for development (to run CLI commands like prisma generate), not for production or the final build output. If your final dist/apps/appname/package.json only includes @prisma/adapter-mariadb and @prisma/instrumentation, that's expected: the generated Prisma Client code is self-contained and does not require the prisma or @prisma/client packages at runtime when using the new generator. Just ensure your build process copies the generated client files into the output directory and that you import from the correct path in your app code. If you need to run migrations or generate the client in production, you must include the prisma CLI as a dependency and ensure the CLI is available. But for runtime, only the generated client is required, not the prisma or @prisma/client packages prisma-client (Preview). If you encounter missing files or issues with monorepo setups, double-check that your build process includes the generated client directory and that your imports are correct. If you use custom output, always import from the generated path, not from @prisma/client Generating Prisma Client Github Issue #18606. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Satont
SatontOP3mo ago
Runtime still imported at generated client.ts, so it is required.
No description
Nurul
Nurul3mo ago
Could you please elaborate on the issue? If you use the old prisma-client-js generator then the issue gets resolved? A minimal reproduction would be helpful in debugging this issue.

Did you find this page helpful?