@@ -27,7 +27,7 @@ interface ResolutionResult {
2727}
2828
2929class ResolutionContext {
30- private noResolvePaths : picomatch . Matcher [ ] ;
30+ private noResolvePaths : RegExp [ ] ;
3131
3232 public diagnostics : ts . Diagnostic [ ] = [ ] ;
3333 public resolvedFiles = new Map < string , ProcessedFile > ( ) ;
@@ -39,7 +39,7 @@ class ResolutionContext {
3939 private readonly plugins : Plugin [ ]
4040 ) {
4141 const unique = [ ...new Set ( options . noResolvePaths ) ] ;
42- const matchers = unique . map ( x => picomatch ( x ) ) ;
42+ const matchers = unique . map ( x => picomatch . makeRe ( x ) ) ;
4343 this . noResolvePaths = matchers ;
4444 }
4545
@@ -73,7 +73,7 @@ class ResolutionContext {
7373 return ;
7474 }
7575
76- if ( this . noResolvePaths . find ( isMatch => isMatch ( required . requirePath ) ) ) {
76+ if ( this . noResolvePaths . find ( isMatch => isMatch . test ( required . requirePath ) ) ) {
7777 if ( this . options . tstlVerbose ) {
7878 console . log (
7979 `Skipping module resolution of ${ required . requirePath } as it is in the tsconfig noResolvePaths.`
@@ -215,14 +215,20 @@ class ResolutionContext {
215215 const fileFromPath = this . getFileFromPath ( resolvedPath ) ;
216216 if ( fileFromPath ) return fileFromPath ;
217217
218- if ( this . options . paths && this . options . baseUrl ) {
218+ if ( this . options . paths ) {
219219 // If no file found yet and paths are present, try to find project file via paths mappings
220- const fileFromPaths = this . tryGetModuleNameFromPaths (
221- dependencyPath ,
222- this . options . paths ,
223- this . options . baseUrl
224- ) ;
225- if ( fileFromPaths ) return fileFromPaths ;
220+ // When baseUrl is not set, resolve paths relative to the tsconfig directory (TS 6.0+ behavior)
221+ const pathsBase =
222+ this . options . baseUrl ??
223+ ( this . options . configFilePath ? path . dirname ( this . options . configFilePath ) : undefined ) ;
224+ if ( pathsBase ) {
225+ const fileFromPaths = this . tryGetModuleNameFromPaths (
226+ dependencyPath ,
227+ this . options . paths ,
228+ pathsBase
229+ ) ;
230+ if ( fileFromPaths ) return fileFromPaths ;
231+ }
226232 }
227233
228234 // Not a TS file in our project sources, use resolver to check if we can find dependency
0 commit comments