Skip to content

Commit f6e7342

Browse files
committed
fixup! fix(@angular/build): include source map hashes in optimized chunk hashes
1 parent b2b5374 commit f6e7342

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎packages/angular/build/src/builders/application/chunk-optimizer.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -278,21 +278,21 @@ export async function optimizeChunks(
278278

279279
return result;
280280
},
281-
augmentChunkHash(chunk: { moduleIds: string[] }) {
282-
if (!sourcemap) {
283-
return;
284-
}
285-
286-
let hash = '';
287-
for (const id of chunk.moduleIds) {
288-
const mapHash = maps[id]?.hash;
289-
if (mapHash) {
290-
hash += mapHash;
281+
...(sourcemap
282+
? {
283+
augmentChunkHash(chunk: { moduleIds: string[] }) {
284+
let hash = '';
285+
for (const id of chunk.moduleIds) {
286+
const mapHash = maps[id]?.hash;
287+
if (mapHash) {
288+
hash += mapHash;
289+
}
290+
}
291+
292+
return hash || undefined;
293+
},
291294
}
292-
}
293-
294-
return hash || undefined;
295-
},
295+
: {}),
296296
},
297297
];
298298

‎packages/angular/build/src/tools/esbuild/bundler-files.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export function createOutputFile(
162162
export function convertOutputFile(file: OutputFile, type: BuildOutputFileType): BuildOutputFile {
163163
let { contents: cachedContents } = file;
164164
let cachedText: string | null = null;
165-
let cachedHash: string | null = file.hash;
165+
let cachedHash: string | null = (file as { hash?: string }).hash ?? null;
166166

167167
return {
168168
get contents(): Uint8Array {

0 commit comments

Comments
 (0)