Hi guys, anyone tried to use RushJS with Prisma b...
# orm-help
d
Hi guys, anyone tried to use RushJS with Prisma before? right now I have a multiple apps inside one repo built using RushJS. and last time, only one back end app (and one prisma inside). But, now there is more than one back end app in the repo, and all of them using Prisma. So I want to separate the Prisma to be in common folder and make its as a library that others backend app will be import. But I keep failed with the error is
TypeError: prisma_1.default is not a constructor
😕 anyone have any idea why? basically I just make an
index.ts
file and
helper.ts
inside that and the content is:
helper.ts
Copy code
import { PrismaClient } from '@prisma/client';

const client = new PrismaClient()

export default client;
index.ts
Copy code
export { default } from './helper'
one of my backend app's index file:
Copy code
import PrismaClient from 'my-library-name';

//just use the PrismaClient I imported like usual
I also tested by adding some console log in
helper.ts
and
index.ts
and when I run the backend app's, the console.log is printed before the error exception is appear. --- tl;dr: I want to make a separate folder for the Prisma to shared into 3 different apps. But, I keep failed at importing the PrismaClient.
r
@David 👋 I haven’t worked with Rush, but if it’s similar to lerna then someone who’s used lerna might be able to help 🙂
I have used Yarn workspaces and importing the client works fine with that.
d
Hi @Ryan , Thanks again to help. btw, no worries, suddenly it's work perfectly fine. I just create one
index.ts
and write:
Copy code
export * from '@prisma/client';
in there. and everything running perfectly fine. I just need to test for some time to make sure everything running well. Once again, thanks a lot 😄
💯 1