From 7e6d74dc6f36ce2eaf818de8976f71cd5742aba9 Mon Sep 17 00:00:00 2001 From: Andrei Alecu Date: Tue, 27 Oct 2020 21:08:23 +0200 Subject: [PATCH] fix: project references --- src/compiler/commandLineParser.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index f5cb2990a593a..6d8d41463c855 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -2372,8 +2372,17 @@ namespace ts { createCompilerDiagnosticOnlyIfJson(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "reference.path", "string"); } else { + let absolutePath = getNormalizedAbsolutePath(ref.path, basePath); + // @ts-ignore + if (process.versions.pnp) { + try { + absolutePath = require("pnpapi").resolveToUnqualified(require(`${absolutePath}/package.json`).name, `${basePath}/`); + } catch { + // do nothing + } + } (projectReferences || (projectReferences = [])).push({ - path: getNormalizedAbsolutePath(ref.path, basePath), + path: absolutePath, originalPath: ref.path, prepend: ref.prepend, circular: ref.circular