-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fixed prisma example to allow importing interfaces from database #2710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed prisma example to allow importing interfaces from database #2710
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Ignored Deployments
|
🟢 CI successful 🟢Thanks |
That was fast 😳, thank you! Also worth mentioning that right now the Using Prisma with Turborepo guide is recommending having {
"main": "./index.ts",
"types": "./index.ts"
} While the See with-prisma/packages/database/package.json It's not clear to the reader (at least to me), what's the benefit of one approach over the other. |
I'm stumbling upon this tonight while trying to get build and start scripts to work for my server code (express backend) I followed the guide in the docs, setting the During development, everything is peachy, but the moment I need to just run the server in production mode, i get this
I went the Here's a sample of what I'm getting with my dev script in the server. I've followed almost everything from the example in the repo when it comes to the prisma code. I'm using
It's also worth noting that I got a bunch of errors when doing anything other than |
Is there any update on this? I cannot get the latest version of Prisma to work in production if I follow the guide on the site and can't get it to work in development if I follow the Has anyone been able to get Prisma to work with an express backend and svelte+rollup frontend? |
I believe I might have found a solution that might be worth a try for those using a plain express backend. Thanks to this article in the Fix module resolution for development and production section, I was able to make use of Node's conditional exports to resolve everything correctly for both dev and prod, while using as minimal a setup as the site's guide proposes. If any of this could be done better, I'm all ears. I'm very much a novice with turborepo and monorepos in general. packages/database/package.json {
"name": "database",
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": {
"prod": "./dist/index.js",
"default": "./src/index.ts"
}
},
"scripts": {
"build": "tsc",
...
}
...
} packages/database/src/index.ts export * from '@prisma/client'; apps/server/package.json {
...
"scripts": {
"start": "node --conditions=prod dist/index.js",
"build": "tsc",
"dev": "nodemon src/index.ts"
},
...
} package.json {
"name": "root",
"private": true,
"workspaces": [
"packages/*",
"apps/*"
],
"scripts": {
"dev": "npm run up & npx turbo dev",
"build": "npx turbo build",
"start": "export NODE_ENV=production && npx turbo start",
"up": "docker-compose up",
...
},
...
} turbo.json {
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"start": {
"cache": false,
"dependsOn": [
"^db:generate",
"build"
]
},
"dev": {
"dependsOn": [
"^db:generate"
],
"cache": false
},
"build": {
"dependsOn": [
"^db:generate",
"^build"
],
"outputs": [
"dist/**",
"build/**",
"vender/**"
]
},
"db:generate": {
"cache": false
},
"db:push": {
"cache": false
}
}
} |
For context:
https://twitter.com/javier_dev/status/1592532624635199489