Skip to content

Commit

Permalink
refactor(@angular/build): support directly merging bundler results
Browse files Browse the repository at this point in the history
The bundler context class now has a static helper method to support merging
bundler results outside of a specific bundle action. This will be used in the
future to support more complex bundling hierarchies.
  • Loading branch information
clydin committed Jun 21, 2024
1 parent db1a6ae commit 1a481c5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/angular/build/src/tools/esbuild/bundler-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ export class BundlerContext {
}),
);

return BundlerContext.mergeResults(individualResults);
}

static mergeResults(results: BundleContextResult[]): BundleContextResult {
// Return directly if only one result
if (individualResults.length === 1) {
return individualResults[0];
if (results.length === 1) {
return results[0];
}

let errors: Message[] | undefined;
Expand All @@ -127,7 +131,7 @@ export class BundlerContext {

const outputFiles = [];
let externalConfiguration;
for (const result of individualResults) {
for (const result of results) {
warnings.push(...result.warnings);
if (result.errors) {
errors ??= [];
Expand Down

0 comments on commit 1a481c5

Please sign in to comment.