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

Commit

Permalink
fix(index): use try-catch instead of if when resolving lib files
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Panferov committed Aug 4, 2015
1 parent 45263f7 commit 946fc85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ function ensureInstance(webpack: IWebPack, options: ICompilerOptions, instanceNa
let libPath = path.join(compilerPath, 'lib', 'lib.d.ts');
let lib6Path = path.join(compilerPath, 'lib', 'lib.es6.d.ts');

if (!require.resolve(libPath)) {
try {
require.resolve(libPath);
} catch(e) {
libPath = path.join(compilerPath, 'bin', 'lib.d.ts');
lib6Path = path.join(compilerPath, 'bin', 'lib.es6.d.ts');
}
Expand Down

0 comments on commit 946fc85

Please sign in to comment.