generated from 47ng/typescript-library-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
The prisma-field-encryption generator produces incorrect import paths when running on Windows. Instead of using the standard package import @prisma/client, it generates absolute Windows file paths that include backslashes, resulting in TypeScript/JavaScript errors.
Example
When generating migration files on Windows, I get incorrect imports like:
// Incorrect (generated on Windows)
import type { PrismaClient, subscriptions } from '../D:\Personal\Projects\expense-flow\node_modules\@prisma\client'
Instead of the correct format:
// Correct
import type { PrismaClient, subscriptions } from '@prisma/client'
Root Cause
After investigating the source code, I found the issue in main.ts. The generator uses POSIX-style path handling (path/posix) but doesn't properly handle Windows backslashes when determining import paths. The current detection logic only checks for paths ending with 'node_modules/@prisma/client', which misses Windows-style paths.
Reproduction Steps
- Create a Next.js/Prisma project on Windows
- Set up prisma-field-encryption in schema.prisma
- Run
npx prisma generate
- Observe incorrect import paths in the generated files
Sumis34
Metadata
Metadata
Assignees
Labels
No labels