Commit 7ffbbac
committed
fix(@angular/build): ensure application builder cleanly exits on thrown post-bundle errors
When an unhandled exception is thrown during post-bundle steps (such as IndexHtmlGenerator.readIndex throwing when an index HTML file is missing or unreadable), executeBuild() previously re-threw without calling .dispose() on executionResult or angularCompilationContext. Consequently, open ESBuild child processes, TypeScript compiler worker threads, and SQLite database connections prevented the Node.js process from exiting.
This commit addresses the issue by:
1. Wrapping the entire body of executeBuild() in a try...catch block and instantiating executionResult immediately after bundlerContexts is created, so any thrown error reliably disposes all worker pools and AST caches before re-throwing.
2. Closing the SQLite cache store (angular-i18n.db) in I18nInliner.close() alongside worker pool destruction.
3. Ensuring Sass workers are shut down in build-action even if an initial --watch build throws an exception.
Closes #337161 parent 902e8ea commit 7ffbbac
4 files changed
Lines changed: 218 additions & 209 deletions
File tree
- packages/angular/build/src
- builders/application
- tests/options
- tools/esbuild
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
0 commit comments