You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@michiim
Yeah.. And for temp solution, since the files generated by zod-prisma-types automatically. I only can run simple patch to remove all of "z.instance(Prisma.Decimal)" after.
async function clean(path: string, files: string[]) {
for await (const file of files) {
let content = fs.readFileSync(resolve(path, `./${file}`), "utf8")
if (content.indexOf("z.instanceof(Prisma.Decimal)") >= 0) {
content = content.replaceAll("z.instanceof(Prisma.Decimal).array(),", "")
content = content.replaceAll("z.instanceof(Prisma.Decimal),", "")
fs.writeFile(resolve(path, `./${file}`), content, "utf8", (err) => {
if (!err) {
console.log(`File ${path}/${file} patched`)
}
})
}
}
}
@fortezhuo
I don't think you should do that. It would be better if zod-prisma-types avoided using Prisma in the schema files, so that these files can also be used in browsers.
Describe the bug
z.instanceof(Prisma.Decimal) is not playing well with vite build while consume schema for client side
Screenshots
Package versions (please complete the following information):
Temp Workaround
I remove all z.instanceof(Prisma.Decimal), and z.instance(Prisma.Decimal).array() using vscode
The text was updated successfully, but these errors were encountered: