Skip to content

Commit

Permalink
fix: load the tsconfig extends with the specific extension name
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenPt authored Apr 19, 2024
1 parent f396e5f commit 66b802c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,14 @@ export function loadTsConfig(tsconfigPath: string): ts.CompilerOptions {
path.resolve(tsconfigDirName, extendPattern),
path.resolve(tsconfigDirName, `${extendPattern}.json`),
];

if (!path.extname(tsConfig.extends) && !extendPattern.startsWith('.') && !extendPattern.startsWith('/')) {

const isExtendFromNodeModules = !extendPattern.startsWith('.') && !extendPattern.startsWith('/');
if (isExtendFromNodeModules) {
const DEFAULT_TS_CONFIG_FILE_NAME = 'tsconfig.json';
const extendTsConfigPath = !path.extname(tsconfigPath) ? DEFAULT_TS_CONFIG_FILE_NAME : '';
maybeRealExtendPath.push(
path.resolve(tsconfigDirName, 'node_modules', extendPattern, 'tsconfig.json'),
path.resolve(process.cwd(), 'node_modules', extendPattern, 'tsconfig.json'),
path.resolve(tsconfigDirName, 'node_modules', extendPattern, extendTsConfigPath),
path.resolve(process.cwd(), 'node_modules', extendPattern, extendTsConfigPath),
);
}

Expand Down

0 comments on commit 66b802c

Please sign in to comment.