Skip to content

perf(@angular-devkit/build-angular): reduce build times for apps with a large number of components when utilizing esbuild-based builders #27281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,11 @@ export function createCompilerPlugin(

// Combine additional metafiles with main metafile
if (result.metafile && metafile) {
result.metafile.inputs = { ...result.metafile.inputs, ...metafile.inputs };
result.metafile.outputs = { ...result.metafile.outputs, ...metafile.outputs };
// Append the existing object, by appending to it we prevent unnecessary new objections creations with spread

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo: objections -> object :)

// mitigating significant performance overhead for large apps.
// See: https://bugs.chromium.org/p/v8/issues/detail?id=11536
Object.assign(result.metafile.inputs, metafile.inputs);
Object.assign(result.metafile.outputs, metafile.outputs);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
context,
} from 'esbuild';
import assert from 'node:assert';
import { basename, dirname, extname, join, relative } from 'node:path';
import { basename, extname, join, relative } from 'node:path';
import { LoadResultCache, MemoryLoadResultCache } from './load-result-cache';
import { convertOutputFile } from './utils';

Expand Down Expand Up @@ -136,8 +136,8 @@ export class BundlerContext {

// Combine metafiles used for the stats option as well as bundle budgets and console output
if (result.metafile) {
metafile.inputs = { ...metafile.inputs, ...result.metafile.inputs };
metafile.outputs = { ...metafile.outputs, ...result.metafile.outputs };
Object.assign(metafile.inputs, result.metafile.inputs);
Object.assign(metafile.outputs, result.metafile.outputs);
}

result.initialFiles.forEach((value, key) => initialFiles.set(key, value));
Expand Down