Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
fix: handle missing paths obj in tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarTachev committed Jan 6, 2020
1 parent 9902999 commit 867a9f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 867a9f1

Please sign in to comment.