Prisma enums in React Native app (create-t3-turbo)

Hi guys, I'm using create-t3-turbo monorepo with NextJS and React Native apps & Prisma. I do have a problem with the generated types tho, as Prisma needs node to run afaik. I have a file in @acme/db package called types.ts that exports my enums:
export {
Voivodeship,
Weekday,
Locale,
Role,
// ...
} from "@prisma/client";
export {
Voivodeship,
Weekday,
Locale,
Role,
// ...
} from "@prisma/client";
In NextJS app it works fine, but in React Native I'm getting this error: Error: Unable to resolve module .prisma/client/index-browser from <MY-USER-PATH>/app/node_modules/@prisma/client/index-browser.js Is there any way that I can use Prisma generated enums in my React Native app, or should I rewrite them? Thanks!
4 Replies
Piotrek
PiotrekOP3y ago
I should add that I need to use enum's values - not types (export type { ... } from ... would not be a problem)
Piotrek
PiotrekOP3y ago
I found the only solution to be to reimplement all the prisma enums...
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Piotrek
PiotrekOP2y ago
I'm still using this method in the same project haha, would love to see some other solutions as well!
Want results from more Discord servers?
Add your server