Cannot run built code when different prisma client output folder
Hi, I came to this problem when I tried to change the prisma client output folder. No matter if I specify folder in src or not, it is not possible to run the build index.js.
When I run it in dev, it works just fine. The build completes just fine (when I omit the --dts tag). But when I want to run it, it always fail on error something like:
Error: Dynamic require of "child_process" is not supported
or
Error: Dynamic require of "fs" is not supported
in generator schema:
output = "../src/generated-prisma-client"
here are my scripts:
here is my tsup config:
and here is the tsconfig:
I believe there is problem in the typescript building config, but honest IDK. Has anyone faced this before? Any suggestion is appreciated.2 Replies
Hi @Zige
Thank you for raising this question.
Can you try changing the output path to point to the root
node_modules
folder as suggested in this previous discussionGitHub
Can't customize output path of Prisma client: Error: Dynamic requir...
Question Hello, I am attempting to customize the location of my Prisma client (https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/generating-prisma-client#the-lo...
after changing it to the node_modules/@prisma/client I got this error:
after doing what the error says, it completes normally. Then I updated the paths in tsconfig and after building, I got this error:
Error: Dynamic require of "fs" is not supported
I even tried to remove the paths in tsconfig and import everything directly, still the same.