File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,19 @@ export type PrincipalOptions = {
18
18
isGitIgnored : GlobbyFilterFunction ;
19
19
} ;
20
20
21
+ const mapToAbsolutePaths = ( paths : NonNullable < Paths > , cwd : string ) : Paths =>
22
+ Object . keys ( paths ) . reduce ( ( result , key ) => {
23
+ result [ key ] = paths [ key ] . map ( entry => toAbsolute ( entry , cwd ) ) ;
24
+ return result ;
25
+ } , { } as NonNullable < Paths > ) ;
26
+
21
27
const mergePaths = ( cwd : string , compilerOptions : ts . CompilerOptions , paths : Paths = { } ) => {
22
- const overridePaths = Object . keys ( paths ) . reduce ( ( overridePaths , key ) => {
23
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
- overridePaths ! [ key ] = paths [ key ] . map ( entry => toAbsolute ( entry , cwd ) ) ;
25
- return overridePaths ;
26
- } , { } as Paths ) ;
27
- compilerOptions . paths = { ...compilerOptions . paths , ...overridePaths } ;
28
+ const compilerPaths =
29
+ ! compilerOptions . baseUrl && compilerOptions . paths
30
+ ? mapToAbsolutePaths ( compilerOptions . paths , cwd )
31
+ : compilerOptions . paths ;
32
+ const extraPaths = mapToAbsolutePaths ( paths , cwd ) ;
33
+ compilerOptions . paths = { ...compilerPaths , ...extraPaths } ;
28
34
return compilerOptions ;
29
35
} ;
30
36
You can’t perform that action at this time.
0 commit comments