@@ -613,7 +613,7 @@ function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOpt
613
613
prefersTsExtension ( allowedEndings ) ,
614
614
) ;
615
615
616
- const fromPaths = pathsOnly || fromPackageJsonImports === undefined ? paths && tryGetModuleNameFromPaths ( relativeToBaseUrl , paths , allowedEndings , host , compilerOptions ) : undefined ;
616
+ const fromPaths = pathsOnly || fromPackageJsonImports === undefined ? paths && tryGetModuleNameFromPaths ( relativeToBaseUrl , paths , allowedEndings , baseDirectory , getCanonicalFileName , host , compilerOptions ) : undefined ;
617
617
if ( pathsOnly ) {
618
618
return fromPaths ;
619
619
}
@@ -925,10 +925,11 @@ function tryGetModuleNameFromAmbientModule(moduleSymbol: Symbol, checker: TypeCh
925
925
}
926
926
}
927
927
928
- function tryGetModuleNameFromPaths ( relativeToBaseUrl : string , paths : MapLike < readonly string [ ] > , allowedEndings : ModuleSpecifierEnding [ ] , host : ModuleSpecifierResolutionHost , compilerOptions : CompilerOptions ) : string | undefined {
928
+ function tryGetModuleNameFromPaths ( relativeToBaseUrl : string , paths : MapLike < readonly string [ ] > , allowedEndings : ModuleSpecifierEnding [ ] , baseDirectory : string , getCanonicalFileName : GetCanonicalFileName , host : ModuleSpecifierResolutionHost , compilerOptions : CompilerOptions ) : string | undefined {
929
929
for ( const key in paths ) {
930
930
for ( const patternText of paths [ key ] ) {
931
- const pattern = normalizePath ( patternText ) ;
931
+ const normalized = normalizePath ( patternText ) ;
932
+ const pattern = getRelativePathIfInSameVolume ( normalized , baseDirectory , getCanonicalFileName ) ?? normalized ;
932
933
const indexOfStar = pattern . indexOf ( "*" ) ;
933
934
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
934
935
// meaning a '.ts' or '.d.ts' extension is allowed to resolve. This is distinct from the case where a '*' substitution
@@ -1290,6 +1291,8 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan
1290
1291
subModuleName ,
1291
1292
versionPaths . paths ,
1292
1293
allowedEndings ,
1294
+ packageRootPath ,
1295
+ getCanonicalFileName ,
1293
1296
host ,
1294
1297
options ,
1295
1298
) ;
0 commit comments