File tree Expand file tree Collapse file tree
heft-plugins/heft-typescript-plugin/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import type {
1717 IExtendedSolutionBuilder ,
1818 ITypeScriptNodeSystem
1919} from './internalTypings/TypeScriptInternals' ;
20- import type { ITypeScriptConfigurationJson } from './TypeScriptPlugin' ;
20+ import type { ITypeScriptConfigurationJson , IEmitModuleKind } from './TypeScriptPlugin' ;
2121import type { PerformanceMeasurer } from './Performance' ;
2222import type {
2323 ICachedEmitModuleKind ,
@@ -152,12 +152,15 @@ export class TypeScriptBuilder {
152152 // We only need to hash our additional Heft configuration.
153153 const configHash : crypto . Hash = crypto . createHash ( 'sha1' ) ;
154154
155- configHash . update ( JSON . stringify ( this . _configuration . additionalModuleKindsToEmit || { } ) ) ;
156- const serializedConfigHash : string = configHash
157- . digest ( 'base64' )
158- . slice ( 0 , 8 )
159- . replace ( / \+ / g, '-' )
160- . replace ( / \/ / g, '_' ) ;
155+ // Relativize the outFolderName paths before hashing to ensure portability across different machines
156+ const normalizedConfig : IEmitModuleKind [ ] | Record < string , never > =
157+ this . _configuration . additionalModuleKindsToEmit ?. map ( ( emitKind ) => ( {
158+ ...emitKind ,
159+ outFolderName : path . relative ( this . _configuration . buildFolderPath , emitKind . outFolderName )
160+ } ) ) || { } ;
161+
162+ configHash . update ( JSON . stringify ( normalizedConfig ) ) ;
163+ const serializedConfigHash : string = configHash . digest ( 'base64url' ) . slice ( 0 , 8 ) ;
161164
162165 // This conversion is theoretically redundant, but it is here to make absolutely sure that the path is formatted
163166 // using only '/' as the directory separator so that incremental builds don't break on Windows.
You can’t perform that action at this time.
0 commit comments