fix(angular): process only the in progress entry points in ng-packagr-lite's write bundles transform function #33784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Behavior
When building Angular libraries with
ng-packagr>20.3.0, the build fails with:This occurs because
ng-packagrv20.3.1 introduced a memory optimization (ng-packagr#3172) that callsdispose()on entry points after they're processed, settingentry.cache = undefined.Nx's custom
writeBundlesTransformwas iterating over all entries in the graph, including already-disposed entry points, causing the crash when accessing their cache.Expected Behavior
Angular library builds should succeed with
ng-packagr>20.3.0, including libraries with secondary entry points. Workspaces using lower versions ofng-packagrshould remain unaffected.Solution
Align with
ng-packagr's own pattern by usinggraph.find(isEntryPointInProgress())to process only the currently in-progress entry point, rather than iterating over all graph entries.Key changes:
isEntryPointInProgress()instead of iterating all entries withisEntryPoint()BuildGraphimport (no longer creating a new graph)This approach:
ng-packagr'swriteBundlesTransformimplementation patternng-packagrversions (v19+) sinceisEntryPointInProgress()has been available since v19Related Issue(s)
Fixes #33560