Commit ec289c3
committed
fix(@angular/build): bundle polyfills to preserve execution order in dev server
When using the development server with ESM, polyfills were built as a mix of bundled local files and external package imports. Due to ESM hoisting behavior, all top-level import statements are executed before any other code in the module. This caused polyfills that modify global state (like zone-flags.js) to run after the polyfills they were intended to configure (like zone.js), rendering the flags ineffective.
This change ensures that all polyfills are bundled together into the single polyfills.js file when using the development server, matching the behavior of the production build and preserving the intended execution order.
Closes #326321 parent b697145 commit ec289c3
File tree
1 file changed
+8
-6
lines changed- packages/angular/build/src/tools/esbuild
1 file changed
+8
-6
lines changedLines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
657 | | - | |
| 657 | + | |
658 | 658 | | |
659 | | - | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
660 | 664 | | |
661 | 665 | | |
662 | 666 | | |
| |||
671 | 675 | | |
672 | 676 | | |
673 | 677 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
| 678 | + | |
| 679 | + | |
678 | 680 | | |
679 | 681 | | |
680 | 682 | | |
| |||
0 commit comments