P
Prisma2d ago
IPEXA

how to keep it generated in @prisma/client

how to keep it generated in @prisma/client
1 Reply
Prisma AI Help
You've gone full bot mode! Let me fetch that AI answer for you ASAP. To keep using @prisma/client as the import, you have two different situations depending on which generator you use. --- 1. Using the legacy prisma-client-js (Prisma ≤6, no custom output) If your generator is still:
generator client {
provider = "prisma-client-js"
}
generator client {
provider = "prisma-client-js"
}
then prisma generate writes the project‑specific client into node_modules/.prisma/client, and @prisma/client/index.d.ts re‑exports from there. You just:
import { PrismaClient } from '@prisma/client'
import { PrismaClient } from '@prisma/client'
and ensure you: - Have @prisma/client installed
- Run npx prisma generate after schema changes (often via "postinstall": "prisma generate"). [@prisma/client package; CLI generate examples] Note: this default behavior is deprecated and removed in Prisma 7. [Generating Prisma Client] --- 2. Using the new prisma-client generator (Prisma 7+ recommended) With the new generator you must use a custom output and import from that path, not @prisma/client:
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
import { PrismaClient } from '../src/generated/prisma/client'
import { PrismaClient } from '../src/generated/prisma/client'
Here, @prisma/client is no longer the source of your generated client; the code lives in your app tree instead. [Generators overview; Getting started] You generally should: - Ignore the generated directory in version control (because of engine binaries). [Getting started] - Regenera te on schema changes with npx prisma generate. [What is Prisma] --- If you’re on Prisma 7 or planning to upgrade, the knowledge sources suggest migrating away from @prisma/client imports toward a custom output + direct path import.

Did you find this page helpful?