Slow prisma generate
baptistemanson opened this issue · comments
Describe the Bug
With one model, I get
✔ Generated Prisma Client (4.15.0 | library) to .\node_modules@prisma\client in 53ms
✔ Generated TypeGraphQL integration to .\node_modules@generated\type-graphql in 69.38s
When testing with a larger schema (19 models) it takes 90-100s.
To Reproduce
generator client {
provider = "prisma-client-js"
}
generator typegraphql {
provider = "typegraphql-prisma"
}
datasource db {
provider = "postgresql"
url = env("POSTGRES_MODEL_STRING")
}
model App {
id String @id @default(uuid())
}
Expected Behavior
We would expect to be just a few seconds.
Environment (please complete the following information):
- OS: Windows 11 (AMD Ryzen 9 3900X 12-Core Processor 3.80 GHz)
- Node v20.3.1
typegraphql-prisma
version 0.26- Prisma version 4.16
- TypeScript version 5.0.3
We were also able to reproduce this issue with a macOS M1 environment.
{
"extends": "ts-node/node16/tsconfig.json",
"compilerOptions": {
"target": "es2018",
"lib": [
"es2018",
"esnext.asynciterable"
],
"module": "commonjs",
"outDir": "./dist",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
}
Have a great day! Tell me how I can help beyond funding (because broke for now)
Some progress; a custom folder outside out of the node_modules brings the performance to some acceptable performance.
for the large model
On my machine with such schema:
https://github.com/MichalLytek/typegraphql-prisma/blob/main/experiments/postgres/prisma/schema.prisma
✔ Generated Prisma Client (4.15.0 | library) to ./prisma/generated/client in 83ms
✔ Generated TypeGraphQL integration to ./prisma/generated/type-graphql in 2.43s
As stated in the docs, emitting to node_modules
does transpilation of the generated TS code on the fly, that's why it's so slow.
Im glad we got a chance to find the solution and document it for future users.
As I use tsx now, I forgot transpilation with ts-node was so slow! Thanks for trying to run it too Michal, I appreciate.
I will close the bug.