Skip to content

refactor(@angular/build): Expose codeBundleCache to buildApplicationInternal#32527

Open
Aukevanoost wants to merge 1 commit intoangular:mainfrom
Aukevanoost:feat/expose-cache
Open

refactor(@angular/build): Expose codeBundleCache to buildApplicationInternal#32527
Aukevanoost wants to merge 1 commit intoangular:mainfrom
Aukevanoost:feat/expose-cache

Conversation

@Aukevanoost
Copy link
Contributor

@Aukevanoost Aukevanoost commented Feb 20, 2026

First off, thanks for having a look at this!

This PR exposes the codeBundleCache used in executeBuild part of the buildApplicationInternal to allow for performant multi-builder setups (because they can share the TS cache).

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Right now the SourceFileCache is initialized locally in the executeBuild() function.

Issue Number: N/A

What is the new behavior?

The SourceFileCache is now part of the InternalOptions, allowing tools that use this builder to (optionally) provide a shared cache that can be re-used over multiple builds. As fallback it will create the default cache object.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

We (native-federation) need this feature to speed up our builder. This way we can share the cache between the ESBuild plugin and main builder which decreases our build time drastically:

If interested, find the changes on our end here (it's a proof-of-concept): https://github.com/native-federation/angular-adapter/pull/4/changes#diff-6508a5b483eb2d55fd58361931d864832b5ba20178c796d07be21f9e8ac327ae

Exposes the codeBundle cache used in executeBuild to allow for
performant multi-builder setups.
@alan-agius4 alan-agius4 requested a review from clydin February 24, 2026 11:46
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 27, 2026
Comment on lines +71 to +73
const cachePath = projectName
? join(cacheBasePath, VERSION, projectName)
: join(cacheBasePath, VERSION);
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT

Suggested change
const cachePath = projectName
? join(cacheBasePath, VERSION, projectName)
: join(cacheBasePath, VERSION);
const cachePath = join(cacheBasePath, VERSION, projectName ?? '');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants