@@ -315,10 +315,13 @@ export function enhance<DbClient extends object>(prisma: DbClient, context?: Enh
315315 }
316316
317317 private createLogicalPrismaImports ( prismaImport : string , prismaClientImport : string , target : string | undefined ) {
318+ const prismaVersion = getPrismaVersion ( ) ;
319+ const runtimeLibraryImportSubPath = prismaVersion && semver . gte ( prismaVersion , '7.0.0' ) ? '/runtime/client' : '/runtime/library' ;
320+
318321 const prismaTargetImport = target === 'edge' ? `${ prismaImport } /edge` : prismaImport ;
319322 const runtimeLibraryImport = this . isNewPrismaClientGenerator
320323 ? // new generator has these types only in "@prisma/client"
321- ' @prisma/client/runtime/library'
324+ ` @prisma/client${ runtimeLibraryImportSubPath } `
322325 : // old generator has these types generated with the client
323326 `${ prismaImport } /runtime/library` ;
324327
@@ -436,8 +439,9 @@ export type Enhanced<Client> =
436439 let generateCmd = `prisma generate --schema "${ logicalPrismaFile } " --generator=${ prismaClientGeneratorName } ` ;
437440
438441 const prismaVersion = getPrismaVersion ( ) ;
439- if ( ! prismaVersion || semver . gte ( prismaVersion , '5.2.0' ) ) {
442+ if ( ! prismaVersion || ( semver . gte ( prismaVersion , '5.2.0' ) && semver . lt ( prismaVersion , '7.0.0' ) ) ) {
440443 // add --no-engine to reduce generation size if the prisma version supports
444+ // v7 has removed this option completely, because it no longer generates an engine
441445 generateCmd += ' --no-engine' ;
442446 }
443447
0 commit comments