prisma-zod-generator icon indicating copy to clipboard operation
prisma-zod-generator copied to clipboard

Doesn't work for ESM modules

Open olalonde opened this issue 1 year ago • 4 comments

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

  • OS:
  • Database:
  • Node.js version:

Prisma Version


olalonde avatar Feb 28 '23 03:02 olalonde

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

omar-dulaimi avatar Mar 02 '23 18:03 omar-dulaimi

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")

olalonde avatar Mar 03 '23 07:03 olalonde

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

tylerR94 avatar Jun 21 '23 06:06 tylerR94

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.

TravLRD avatar Aug 20 '23 11:08 TravLRD