Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Commit 946fc85

Browse files
author
Stanislav Panferov
committed
fix(index): use try-catch instead of if when resolving lib files
1 parent 45263f7 commit 946fc85

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ function ensureInstance(webpack: IWebPack, options: ICompilerOptions, instanceNa
136136
let libPath = path.join(compilerPath, 'lib', 'lib.d.ts');
137137
let lib6Path = path.join(compilerPath, 'lib', 'lib.es6.d.ts');
138138

139-
if (!require.resolve(libPath)) {
139+
try {
140+
require.resolve(libPath);
141+
} catch(e) {
140142
libPath = path.join(compilerPath, 'bin', 'lib.d.ts');
141143
lib6Path = path.join(compilerPath, 'bin', 'lib.es6.d.ts');
142144
}

0 commit comments

Comments
 (0)