.prisma directory no longer exists in node_modules with prisma-client-js generator
Hi, I upgraded from Prisma 6.10.1 to 6.14.0 but maintained my generator as prisma-client-js
However, I noticed that the
.prisma
directory in node_modules
no longer exists. I needed this for use in my monorepo for getting type support in my frontend apps with Vite. I had this in my Vite config:
".prisma/client/index-browser": resolve(
__dirname,
"../../node_modules/.prisma/client/index-browser.js",
),
Has this been moved? How can I maintain this functionality without moving to the new generator? Thanks!2 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
With Prisma 6.6.0 and later, the default behavior of generating the Prisma Client into node_modules (specifically, node_modules/.prisma) is being deprecated and will be removed in Prisma v7. The Prisma team now recommends specifying a custom output path for the generated client, outside of node_modules, to avoid issues with tools like Vite and monorepo setups. This change is part of a broader move to make Prisma's behavior more predictable and to avoid "magical" generation in node_modules, which caused problems with file watching, bundlers, and type resolution in many setups, including Vite and pnpm monorepos Why Prisma ORM Generates Code into Node Modules & Why It’ll Change.
If you still use the prisma-client-js generator, you can try explicitly setting the output in your schema.prisma:
However, this approach is now discouraged and may not work reliably, especially with pnpm or in monorepos, as the generated files may not appear where you expect due to changes in how dependencies are hoisted and symlinked Module '"@prisma/client"' has no exported member 'PrismaClient'.ts(2305).
Recommended approach:
- Set the output to a directory within your source tree (e.g., ./src/generated/prisma). - Update your Vite config and imports to reference this new location. - Add the generated directory to your .gitignore. Example: This will ensure type support and compatibility with Vit e and monorepo setups going forward.
- Set the output to a directory within your source tree (e.g., ./src/generated/prisma). - Update your Vite config and imports to reference this new location. - Add the generated directory to your .gitignore. Example: This will ensure type support and compatibility with Vit e and monorepo setups going forward.
Did the bot response help?