@@ -251,10 +251,10 @@ namespace ts {
251251 function emitSourceFileOrBundle ( { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } : EmitFileNames , sourceFileOrBundle : SourceFile | Bundle | undefined ) {
252252 let buildInfoDirectory : string | undefined ;
253253 if ( buildInfoPath && sourceFileOrBundle && isBundle ( sourceFileOrBundle ) ) {
254- buildInfoDirectory = getDirectoryPath ( buildInfoPath ) ;
254+ buildInfoDirectory = getDirectoryPath ( getNormalizedAbsolutePath ( buildInfoPath , host . getCurrentDirectory ( ) ) ) ;
255255 bundleBuildInfo = {
256256 commonSourceDirectory : relativeToBuildInfo ( host . getCommonSourceDirectory ( ) ) ,
257- sourceFiles : sourceFileOrBundle . sourceFiles . map ( file => relativeToBuildInfo ( file . fileName ) )
257+ sourceFiles : sourceFileOrBundle . sourceFiles . map ( file => relativeToBuildInfo ( getNormalizedAbsolutePath ( file . fileName , host . getCurrentDirectory ( ) ) ) )
258258 } ;
259259 }
260260 emitJsFileOrBundle ( sourceFileOrBundle , jsFilePath , sourceMapFilePath , relativeToBuildInfo ) ;
@@ -629,10 +629,14 @@ namespace ts {
629629 getNewLine ( ) : string ;
630630 }
631631
632- function createSourceFilesFromBundleBuildInfo ( bundle : BundleBuildInfo , buildInfoDirectory : string ) : ReadonlyArray < SourceFile > {
632+ function createSourceFilesFromBundleBuildInfo ( bundle : BundleBuildInfo , buildInfoDirectory : string , host : EmitUsingBuildInfoHost ) : ReadonlyArray < SourceFile > {
633633 const sourceFiles = bundle . sourceFiles . map ( fileName => {
634634 const sourceFile = createNode ( SyntaxKind . SourceFile , 0 , 0 ) as SourceFile ;
635- sourceFile . fileName = getNormalizedAbsolutePath ( fileName , buildInfoDirectory ) ;
635+ sourceFile . fileName = getRelativePathFromDirectory (
636+ host . getCurrentDirectory ( ) ,
637+ getNormalizedAbsolutePath ( fileName , buildInfoDirectory ) ,
638+ ! host . useCaseSensitiveFileNames ( )
639+ ) ;
636640 sourceFile . text = "" ;
637641 sourceFile . statements = createNodeArray ( ) ;
638642 return sourceFile ;
@@ -676,7 +680,7 @@ namespace ts {
676680
677681 const buildInfo = getBuildInfo ( buildInfoText ) ;
678682 if ( ! buildInfo . bundle || ! buildInfo . bundle . js || ( declarationText && ! buildInfo . bundle . dts ) ) return buildInfoPath ! ;
679- const buildInfoDirectory = getDirectoryPath ( buildInfoPath ! ) ;
683+ const buildInfoDirectory = getDirectoryPath ( getNormalizedAbsolutePath ( buildInfoPath ! , host . getCurrentDirectory ( ) ) ) ;
680684 const ownPrependInput = createInputFiles (
681685 jsFileText ,
682686 declarationText ! ,
@@ -692,7 +696,7 @@ namespace ts {
692696 ) ;
693697 const outputFiles : OutputFile [ ] = [ ] ;
694698 const prependNodes = createPrependNodes ( config . projectReferences , getCommandLine , f => host . readFile ( f ) ) ;
695- const sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo ( buildInfo . bundle , buildInfoDirectory ) ;
699+ const sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo ( buildInfo . bundle , buildInfoDirectory , host ) ;
696700 const emitHost : EmitHost = {
697701 getPrependNodes : memoize ( ( ) => [ ...prependNodes , ownPrependInput ] ) ,
698702 getCanonicalFileName : host . getCanonicalFileName ,
0 commit comments