@@ -117,7 +117,7 @@ namespace ts.moduleSpecifiers {
117117 }
118118
119119 function getLocalModuleSpecifier ( moduleFileName : string , { getCanonicalFileName, sourceDirectory } : Info , compilerOptions : CompilerOptions , { ending, relativePreference } : Preferences ) : string {
120- const { baseUrl, paths, rootDirs } = compilerOptions ;
120+ const { baseUrl, paths, rootDirs, bundledPackageName } = compilerOptions ;
121121
122122 const relativePath = rootDirs && tryGetModuleNameFromRootDirs ( rootDirs , moduleFileName , sourceDirectory , getCanonicalFileName , ending , compilerOptions ) ||
123123 removeExtensionAndIndexPostFix ( ensurePathIsNonModuleName ( getRelativePathFromDirectory ( sourceDirectory , moduleFileName , getCanonicalFileName ) ) , ending , compilerOptions ) ;
@@ -130,8 +130,9 @@ namespace ts.moduleSpecifiers {
130130 return relativePath ;
131131 }
132132
133- const importRelativeToBaseUrl = removeExtensionAndIndexPostFix ( relativeToBaseUrl , ending , compilerOptions ) ;
134- const fromPaths = paths && tryGetModuleNameFromPaths ( removeFileExtension ( relativeToBaseUrl ) , importRelativeToBaseUrl , paths ) ;
133+ const bundledPkgName = bundledPackageName ? combinePaths ( bundledPackageName , relativeToBaseUrl ) : relativeToBaseUrl ;
134+ const importRelativeToBaseUrl = removeExtensionAndIndexPostFix ( bundledPkgName , ending , compilerOptions ) ;
135+ const fromPaths = paths && tryGetModuleNameFromPaths ( removeFileExtension ( bundledPkgName ) , importRelativeToBaseUrl , paths ) ;
135136 const nonRelative = fromPaths === undefined ? importRelativeToBaseUrl : fromPaths ;
136137
137138 if ( relativePreference === RelativePreference . NonRelative ) {
@@ -224,7 +225,7 @@ namespace ts.moduleSpecifiers {
224225 host ,
225226 /*preferSymlinks*/ true ,
226227 path => {
227- // dont return value, so we collect everything
228+ // don't return value, so we collect everything
228229 allFileNames . set ( path , getCanonicalFileName ( path ) ) ;
229230 importedFileFromNodeModules = importedFileFromNodeModules || pathContainsNodeModules ( path ) ;
230231 }
0 commit comments