Skip to content

Commit

Permalink
fix: tolerate an undefined baseUrl compiler option
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Apr 20, 2022
1 parent 98bbcdc commit 6a88d79
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/config-loader.ts
Expand Up @@ -22,7 +22,7 @@ export interface ConfigLoaderParams {
export interface ConfigLoaderSuccessResult {
resultType: "success";
configFileAbsolutePath: string;
baseUrl: string;
baseUrl?: string;
absoluteBaseUrl: string;
paths: { [key: string]: Array<string> };
mainFields?: Array<string>;
Expand Down Expand Up @@ -76,21 +76,15 @@ export function configLoader({
};
}

if (!loadResult.baseUrl) {
return {
resultType: "failed",
message: "Missing baseUrl in compilerOptions",
};
}

const tsConfigDir = path.dirname(loadResult.tsConfigPath);
const absoluteBaseUrl = path.join(tsConfigDir, loadResult.baseUrl);

return {
resultType: "success",
configFileAbsolutePath: loadResult.tsConfigPath,
baseUrl: loadResult.baseUrl,
absoluteBaseUrl,
absoluteBaseUrl: path.join(
path.dirname(loadResult.tsConfigPath),
loadResult.baseUrl || ""
),
paths: loadResult.paths || {},
addMatchAll: loadResult.baseUrl !== undefined,
};
}

0 comments on commit 6a88d79

Please sign in to comment.