From 867a9f1f8fc9a0c848b7bd321b073b270094dee9 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Mon, 6 Jan 2020 15:56:59 +0200 Subject: [PATCH] fix: handle missing paths obj in tsconfig --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 05b13ab1..0840f7dc 100644 --- a/index.js +++ b/index.js @@ -242,7 +242,9 @@ function replacePathInCompilerOptions({ compilerOptions, targetPath, replacement } function ensurePathInCompilerOptions({ compilerOptions, sourcePath, destinationPath }) { - const paths = (compilerOptions && compilerOptions.paths) || {}; + compilerOptions = compilerOptions || {}; + compilerOptions.paths = compilerOptions.paths || {}; + const paths = compilerOptions.paths; if (paths[sourcePath]) { if (Array.isArray(paths[sourcePath]) && paths[sourcePath].indexOf(destinationPath) === -1) { paths[sourcePath].push(destinationPath);