Skip to content

Commit

Permalink
fix: replacer got an invalid path if tsconfig.json is out of package …
Browse files Browse the repository at this point in the history
…dir (#200)
  • Loading branch information
Helium-Z authored Sep 20, 2023
1 parent 7f03f65 commit c56caaa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/trie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/** */
import { isAbsolute, normalize, relative } from 'path';
import { isAbsolute, normalize, relative, resolve } from 'path';
import { findBasePathOfAlias, relativeOutPathToConfigDir } from '../helpers';
import { Alias, IProjectConfig, PathLike } from '../interfaces';

Expand Down Expand Up @@ -83,7 +83,10 @@ export class TrieNode<T> {
.replace(/\*$/, '')
.replace(/\.([mc])?ts(x)?$/, '.$1js$2');
if (isAbsolute(path)) {
path = relative(config.configDir, path);
path = relative(
resolve(config.configDir, config.baseUrl),
path
);
}

if (
Expand Down

0 comments on commit c56caaa

Please sign in to comment.