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

imports that use non-relative paths are generated with relative paths.

Open obibring opened this issue 2 years ago • 2 comments

Hi there, thanks for building this!

Are non-relative paths supported for the imports config property? I'm seeing the following:

Observed Behavior

Given the following config in schema.prisma:

generator zod {
   imports = "@my-org/custom-zod"
}

The generated typescript contains a relative import path:

import * as imports from "../../prisma/@my-org/custom-zod"

Expected Behavior

import * as imports from "@my-org/custom-zod"

obibring avatar Mar 21 '22 17:03 obibring

Hey @obibring, glad you are enjoying the package!

Right now the generator is not setup to handle this use case but this makes a ton of sense! I'll get to work on a fix for you and let you know when a fix is out.

For now simply pointing to the package in the node_modules directory (ie. ../../node_modules/@my-org/custom-zod) should mitigate the issue.

CarterGrimmeisen avatar Mar 21 '22 18:03 CarterGrimmeisen

Thanks @CarterGrimmeisen !

obibring avatar Mar 22 '22 17:03 obibring