-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use a default import so that the code is ESM compatible #99
Comments
Is this with "type": "module" or one of the command line flags for node? |
I am using "type": "module" |
Okay, last question. I'm looking to try and test some of these changes myself. How are you running node on these typescript files? Are you just compiling them with tsc and then running them? Are you using ts-node? Thanks in advance for your help! |
I am using ts-node like this: https://twitter.com/capajj/status/1496057264586768388?t=h2WClBTeWWGEW5m-X6ZKkw&s=19 😅 |
…pt files for use with module: es2022 and type: module
Could you test the fix from the fix/99 branch by placing this tarball (zod-prisma-v0.5.5.tar.gz) in your project directory and updating your package.json with the following? "zod-prisma": "file:./zod-prisma-v0.5.5.tar.gz" Thanks for your help! |
Whoops! You'll also have to add the following to your schema.prisma generator zod {
...
nodeEsModules = true // this line
} |
In one of the files generated I have:
this causes a problem when I use native ESM modules. Node.js is not able to import that as named export:
it would be much better to generate the file like this:
this way it will work fine on commonJS and native ESM.
There is an issue in prisma repo which might explain the problem further:
prisma/prisma#4816
The text was updated successfully, but these errors were encountered: