Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 6233357

Browse files
committed
don't throw errors for missing or invalid config file
1 parent 36093af commit 6233357

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/loadCompilerOptions.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ import * as ts from "typescript";
33
export const loadCompilerOptions = (): ts.CompilerOptions => {
44
const configFileName = ts.findConfigFile(process.cwd(), ts.sys.fileExists);
55
if (!configFileName) {
6-
throw new Error("Could not find config file!");
6+
return {};
77
}
8-
98
const result = ts.readConfigFile(configFileName, ts.sys.readFile);
109
if (result.error) {
11-
let message;
12-
if (typeof result.error.messageText === "string") {
13-
message = result.error.messageText;
14-
} else {
15-
message = result.error.messageText.messageText;
16-
}
17-
throw new Error(message);
10+
return {};
1811
}
1912
return result.config.compilerOptions;
2013
};

0 commit comments

Comments
 (0)