-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Bug description
Using the new generator and besides all of the type errors (which I believe should be patched soon) I have another error related to how the code is generated.
When trying to use an enum for example on the client side it throws errors like
Module build failed: UnhandledSchemeError: Reading from "node:child_process"
This is because the code is all in the entry point and client for the generator (index.ts) and it's only functional on the server as it's mixed in with Node specific libraries.
Cannot use enums when submitting to endpoints and more importantly cannot augment types for the frontend eg.
type UserWithSocials = Prisma.UserGetPayload<{
include: { socials: true };
}>;
Severity
Reproduction
- Install
"@prisma/client": "6.8.0-dev.24",
- Generate code with prisma generate with an enum defined in your schema
- Try use the enum as a value in any frontend code
Expected vs. Actual Behavior
Expected: Should be able to use all code polymorphically eg. Server libraries should be isolated. Perhaps a seperate entry point
Current: All code is bundled together so when importing is not ready for both enviroments.
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Not a regression but rather a bug of the new generator.
Workaround
You can manually define enums. No workaround for types that extend from Prisma
eg. Prisma.UserGetPayload
Prisma Schema & Queries
generator client {
provider = "prisma-client"
previewFeatures = ["driverAdapters"]
output = "../generated"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
enum Role {
ADMIN
USER
}
import { Prisma } from 'app/generated/prisma/client'
Prisma Config
Using package.json field
### Logs & Debug Info
// Debug logs here
### Environment & Setup
- **OS:** macOS
- **Database:** Postgres (Neon)
- **Node.js version:** v22.15.0
### Prisma Version
6.8.0-dev.24
// Prisma version output