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

Commit 867a9f1

Browse files
committed
fix: handle missing paths obj in tsconfig
1 parent 9902999 commit 867a9f1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ function replacePathInCompilerOptions({ compilerOptions, targetPath, replacement
242242
}
243243

244244
function ensurePathInCompilerOptions({ compilerOptions, sourcePath, destinationPath }) {
245-
const paths = (compilerOptions && compilerOptions.paths) || {};
245+
compilerOptions = compilerOptions || {};
246+
compilerOptions.paths = compilerOptions.paths || {};
247+
const paths = compilerOptions.paths;
246248
if (paths[sourcePath]) {
247249
if (Array.isArray(paths[sourcePath]) && paths[sourcePath].indexOf(destinationPath) === -1) {
248250
paths[sourcePath].push(destinationPath);

0 commit comments

Comments
 (0)