Commit ac10f32
committed
fix(@angular/build): relax requirement for files to be in TS compilation
Previously, any TypeScript file processed by the Angular esbuild plugin had to be part of the main TypeScript compilation defined in `tsconfig.json`. This caused errors for valid use cases, such as importing utility scripts that don't contain Angular-specific code.
This change introduces a more flexible approach:
- If a file is not found in the TS compilation, its contents are checked for Angular metadata (e.g., `@Component`, `@NgModule`).
- If Angular metadata is present, an error is correctly reported with an improved, actionable diagnostic message.
- If no Angular metadata is found, the file is passed to esbuild with a warning, allowing it to be included in the bundle without being type-checked.
This improves the developer experience by reducing build failures for non-critical files while maintaining strict compilation for core Angular code. The diagnostic messages are now clearer and provide better guidance.1 parent e304821 commit ac10f32
File tree
1 file changed
+51
-14
lines changed- packages/angular/build/src/tools/esbuild/angular
1 file changed
+51
-14
lines changedLines changed: 51 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
441 | 443 | | |
442 | 444 | | |
443 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
444 | 460 | | |
445 | 461 | | |
446 | | - | |
447 | | - | |
448 | | - | |
| 462 | + | |
449 | 463 | | |
450 | 464 | | |
451 | 465 | | |
| |||
762 | 776 | | |
763 | 777 | | |
764 | 778 | | |
765 | | - | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
766 | 785 | | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
775 | 801 | | |
776 | 802 | | |
777 | 803 | | |
778 | | - | |
| 804 | + | |
779 | 805 | | |
780 | 806 | | |
781 | 807 | | |
782 | 808 | | |
783 | | - | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
784 | 821 | | |
0 commit comments