omar-dulaimi / prisma-zod-generator

Prisma 2+ generator to emit Zod schemas from your Prisma schema
MIT License
513 stars 45 forks source link

Doesn't work for ESM modules #77

Open olalonde opened 1 year ago

olalonde commented 1 year ago

Bug description

All the imports would need to end with .js extension.

How to reproduce

Try to use in a ESM module.

Expected behavior

No response

Prisma information

Environment & setup

Prisma Version

omar-dulaimi commented 1 year ago

@olalonde Is there really no way but to use a js extension?

olalonde commented 1 year ago

That's the only way as far as I know. See https://www.typescriptlang.org/docs/handbook/esm-node.html

relative import paths need full extensions (e.g we have to write import "./foo.js" instead of import "./foo")

tylerR94 commented 1 year ago

Just curious if there's an update here? Did you manage to find any work arounds @olalonde Would hate to not use such an awesome package just because of this ESM constraint

TravLRD commented 1 year ago

I would also be interested in a generator option for setting if you're using ESM modules of commonjs modules (like in packege.json). This is the only reason I can't use it.