Skip to content

Commit

Permalink
Support extends when parsing tsconfig.json file (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyohaplotinka authored Mar 3, 2024
1 parent 6976499 commit 77f507d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,17 @@ function prepareCompilerOptions(cache: Map<string, CompilerOptions>, file: strin
?? ts.findConfigFile(file, ts.sys.fileExists);

if (location) {
const parsed = ts.readConfigFile(location, ts.sys.readFile);
const { config, error } = ts.readConfigFile(location, ts.sys.readFile);

if (parsed.error) {
throw parsed.error;
if (error) {
throw error;
}

const configLocation = dirname(location)
const { options: tsconfigOptions } = ts.parseJsonConfigFileContent(config, ts.sys, configLocation)

const compilerOptions = {
...parsed.config.compilerOptions,
...tsconfigOptions,
...options?.tsconfig?.override,
} satisfies CompilerOptions;

Expand Down

0 comments on commit 77f507d

Please sign in to comment.