This repository tests the module resolution of @prisma/client
in a PNPM monorepo.
pnpm install
cd packages\server
pnpm run generate
The typescript compilation fails
$ pnpx tsc
src/script.ts:1:24 - error TS2305: Module '"../node_modules/@prisma/client"' has no exported member 'User'.
1 import { PrismaClient, User } from '@prisma/client'
~~~~
The type User
statement import { PrismaClient, User } from '@prisma/client'
in src/script.ts
cannot be resolved.
It seems that the module @prisma/client
is resolved to
node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/index.d.ts
under the project root's node_modules
rather than packages/server/node_modules/@prisma/client/index.d.ts
.
The same code has no problem when using NPM instead of PNPM.