Prisma enums not getting tree shaken in mono repo package #7737
Replies: 2 comments 7 replies
-
So, changing the module worked...almost.. the only problem is that Prisma outputs When I try use an enum in a client function, I get the builtin error:
However, this works fine when I import the prisma client from within the remix codebase. Not sure why this would be since I have both Maybe this is something vite can fix? |
Beta Was this translation helpful? Give feedback.
-
Ok, I was able to get this to work, but the process is so convoluted, it's not worth it. I would not recommend using a monorepo with Remix, at least not with prisma to share the db logic among multiple services. It's to complicated to even post. Will probably do a writeup on it later. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So, I'm wanting to share the authentication logic among multiple services with this code in my mono repo:
Here,
Role
is an enum which contains different roles someone at the company can have. If I have this logic in my app, it works fine. I can use theRole
enum, because it contains no server logic.However if I import this function from my mono repo package, it bundles the prisma server logic as well:
I'm not understanding why the server logic is tree shaken within the app, but not in the mono repo package. Maybe because webpack is bundling the code in the app, and
tsc
transpiles the code, removing the es modules, so webpack can't tree shake it?Asking this question has made me decide to see what will happen if I convert the repo to an esm. Will report back results (if I remember).
Beta Was this translation helpful? Give feedback.
All reactions