Skip to content

Commit c56caaa

Browse files
authored
fix: replacer got an invalid path if tsconfig.json is out of package dir (#200)
1 parent 7f03f65 commit c56caaa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils/trie.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
/** */
15-
import { isAbsolute, normalize, relative } from 'path';
15+
import { isAbsolute, normalize, relative, resolve } from 'path';
1616
import { findBasePathOfAlias, relativeOutPathToConfigDir } from '../helpers';
1717
import { Alias, IProjectConfig, PathLike } from '../interfaces';
1818

@@ -83,7 +83,10 @@ export class TrieNode<T> {
8383
.replace(/\*$/, '')
8484
.replace(/\.([mc])?ts(x)?$/, '.$1js$2');
8585
if (isAbsolute(path)) {
86-
path = relative(config.configDir, path);
86+
path = relative(
87+
resolve(config.configDir, config.baseUrl),
88+
path
89+
);
8790
}
8891

8992
if (

0 commit comments

Comments
 (0)