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

fix: handle missing paths obj in tsconfig #1110

Merged
merged 1 commit into from
Jan 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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