From fb344ea26c04feea0e48be170d9934e2903eedaf Mon Sep 17 00:00:00 2001 From: Lukas Heddendorp Date: Tue, 7 Sep 2021 19:07:36 +0200 Subject: [PATCH 1/2] Fix import path on windows commit for #143 --- src/generator/models/javascript.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generator/models/javascript.ts b/src/generator/models/javascript.ts index 17283fa76..b5fb6016a 100644 --- a/src/generator/models/javascript.ts +++ b/src/generator/models/javascript.ts @@ -118,9 +118,9 @@ export function createModuleSpec(params: { const gentimeSettings = ${JSON.stringify(gentimeSettings.data, null, 2)} const dmmf = getPrismaClientDmmf({ - require: () => require('${gentimeSettings.data.prismaClientImportId}'), + require: () => require(${JSON.stringify(gentimeSettings.data.prismaClientImportId)}), importId: gentimeSettings.prismaClientImportId, - importIdResolved: require.resolve('${gentimeSettings.data.prismaClientImportId}') + importIdResolved: require.resolve(${JSON.stringify(gentimeSettings.data.prismaClientImportId)}) }) const models = ModelsGenerator.JS.createNexusTypeDefConfigurations(dmmf, { From e3effeb8c7fa00bf6f443d900d88597770db1023 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Fri, 10 Sep 2021 09:27:02 -0400 Subject: [PATCH 2/2] Update src/generator/models/javascript.ts --- src/generator/models/javascript.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/generator/models/javascript.ts b/src/generator/models/javascript.ts index b5fb6016a..b0985b768 100644 --- a/src/generator/models/javascript.ts +++ b/src/generator/models/javascript.ts @@ -118,6 +118,9 @@ export function createModuleSpec(params: { const gentimeSettings = ${JSON.stringify(gentimeSettings.data, null, 2)} const dmmf = getPrismaClientDmmf({ + // JSON stringify the values to ensure proper escaping + // Details: https://github.com/prisma/nexus-prisma/issues/143 + // TODO test that fails without this code require: () => require(${JSON.stringify(gentimeSettings.data.prismaClientImportId)}), importId: gentimeSettings.prismaClientImportId, importIdResolved: require.resolve(${JSON.stringify(gentimeSettings.data.prismaClientImportId)})