fix(@angular/build): only use external packages for polyfills when no local files are present#32761
Open
clydin wants to merge 1 commit intoangular:mainfrom
Open
fix(@angular/build): only use external packages for polyfills when no local files are present#32761clydin wants to merge 1 commit intoangular:mainfrom
clydin wants to merge 1 commit intoangular:mainfrom
Conversation
… local files are present The polyfills bundle now conditionally employs external package resolution only if no local files are detected in the polyfills array. If local files are present, all polyfills are bundled together to ensure the import execution order is correctly preserved between local and package-based entries.
There was a problem hiding this comment.
Code Review
This pull request adjusts the polyfill bundling process. A new isLocalFile helper function is introduced to determine if a polyfill entry is a local file path. When a local file is detected among the polyfills, external package resolution is disabled for the polyfills bundle. This forces all polyfills, whether local or from packages, to be bundled together, which preserves their specified execution order. When no local files are in the polyfills list, the behavior respects the configured externalPackages option.
alan-agius4
approved these changes
Mar 13, 2026
alan-agius4
reviewed
Mar 13, 2026
Comment on lines
+761
to
+767
| function isLocalFile(path: string): boolean { | ||
| if (path === 'zone.js' || path.startsWith('zone.js/')) { | ||
| return false; | ||
| } | ||
|
|
||
| return path.startsWith('.') || /\.[mc]?[jt]sx?$/.test(path); | ||
| } |
Collaborator
There was a problem hiding this comment.
NIT:
Suggested change
| function isLocalFile(path: string): boolean { | |
| if (path === 'zone.js' || path.startsWith('zone.js/')) { | |
| return false; | |
| } | |
| return path.startsWith('.') || /\.[mc]?[jt]sx?$/.test(path); | |
| } | |
| function isLocalFile(path: string): boolean { | |
| if (path.startsWith('zone.js')) { | |
| return false; | |
| } | |
| return path[0] === '.' || /\.[mc]?[jt]sx?$/.test(path); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The polyfills bundle now conditionally employs external package resolution only if no local files are detected in the polyfills array. If local files are present, all polyfills are bundled together to ensure the import execution order is correctly preserved between local and package-based entries.