ejazahm3d / fullstack-turborepo-starter

Fullstack Turborepo starter. Typescript, Nestjs, Nextjs, Tailwind, Prisma, Github Actions, Docker, And Reverse proxy configured
MIT License
518 stars 62 forks source link

how to split prisma into its own packages? #2

Closed robertwt7 closed 1 year ago

robertwt7 commented 1 year ago

Hi there!

This is a really cool repo, thanks for creating this.. at the moment I have a similar setup to yours, but the difference is i want to split the prisma into its own package to reuse the type definition between client and server.

At the moment I can't seem to make it work with the server since it says:

core:dev: /home/robertwt7/Development/hublr/packages/database/src/index.ts:1
core:dev: export * from "@prisma/client";
core:dev: ^^^^^^
core:dev: 
core:dev: SyntaxError: Unexpected token 'export'

However for the client it works fine, I am using very similar setup to yours for the tsconfig.json and was hoping to get your insights if you have. do i need to build the database package before using it with NestJS? weirdly it works just fine for the NextJS app

DarkPhoenix2704 commented 1 year ago

https://turbo.build/repo/docs/handbook/tools/prisma

@robertwt7 Have you checked this?

kenjam97 commented 1 year ago

I'm actually trying to do the same thing, having followed the turborepo docs for prisma, I believe the issue is to do with webpack, but have been unable to resolve it myself so far

ejazahm3d commented 1 year ago

If anyone comes to this issue in future, then here is a solution for it. https://github.com/ejazahm3d/fullstack-turborepo-starter/issues/6#issuecomment-1669348627