What is @angular/compiler-cli?
The @angular/compiler-cli package provides command-line interfaces to perform Angular compilations. It is primarily used to compile Angular applications into JavaScript code that can be executed by browsers. It leverages the Angular Compiler (ngc) which is a superset of the TypeScript compiler (tsc) and includes Angular-specific metadata processing.
What are @angular/compiler-cli's main functionalities?
Ahead-of-Time (AOT) Compilation
Compiles Angular HTML and TypeScript code into efficient JavaScript code during the build process before the browser downloads and runs that code. This is the main feature of the compiler-cli which results in faster rendering, fewer asynchronous requests, smaller Angular framework download size, and better security.
ngc -p tsconfig.app.json
Incremental Builds
Supports incremental compilation by reusing the previous compilation results to speed up subsequent compilations. This feature is useful for large projects to reduce build times.
ngc --incremental
Link Time Code Generation
Processes libraries to generate Ivy-compatible code as part of the Angular Ivy compilation pipeline. This feature is used when compiling libraries with the Ivy renderer.
ngc --create-ivy-entry-points
Other packages similar to @angular/compiler-cli
typescript
The TypeScript compiler is similar to @angular/compiler-cli in that it compiles TypeScript code to JavaScript. However, it does not have Angular-specific metadata processing capabilities and is not tailored for Angular applications.
babel
Babel is a JavaScript compiler that can transform syntax, polyfill features that are missing in your target environment, and more. While it is not specific to Angular, it is often used in the JavaScript ecosystem for compiling next-generation JavaScript code down to a form that can be executed in current browsers.
webpack
Webpack is a module bundler that can also perform various optimizations and transformations on your code, including compiling TypeScript with the appropriate loader. It is more general-purpose compared to @angular/compiler-cli and is used in a wide variety of JavaScript applications, not just Angular.
20.0.0-next.2 (2025-03-12)
Breaking Changes
core
-
InjectFlags
has been removed.
inject
no longer accepts InjectFlags
.
Injector.get
no longer accepts InjectFlags
.
EnvironmentInjector.get
no longer accepts InjectFlags
.
TestBed.get
no longer accepts InjectFlags
.
TestBed.inject
no longer accepts InjectFlags
.
- The
any
overload has been removed from
injector.get
. It now only supports ProviderToken<T>
and (deprecated
since v4) string
.
ApplicationRef.tick
will no longer catch and report
errors to the appplication ErrorHandler
. Errors will instead be thrown out of
the method and will allow callers to determine how to handle these
errors, such as aborting follow-up work or reporting the error and
continuing.
Deprecations
platform-browser
- HammerJS support is deprecated and will be removed in a future major version.
common
| Commit | Type | Description |
| -- | -- | -- |
| 92250493ff | fix | support equality function in httpResource (#60026) |
compiler
| Commit | Type | Description |
| -- | -- | -- |
| ef1fd137a9 | fix | incorrect spans for template literals (#60323) |
compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| a1cacc5b17 | fix | avoid fatal diagnostics for missing template files (#58673) |
| 9be2b334ed | fix | handle transformed classes when generating HMR code (#60298) |
core
| Commit | Type | Description |
| -- | -- | -- |
| 611baaf069 | feat | remove InjectFlags from public API (#60318) |
| e170d24240 | fix | add migration away from InjectFlags (#60318) |
| 79ae35577e | fix | check whether application is destroyed before initializing event replay (#59789) |
| c82384104f | fix | ensures immediate trigger fires properly with lazy loaded routes (#60203) |
| de2bfc0913 | fix | fix removal of a container reference used in the component file (#60210) |
| ff772d7800 | fix | fix typing on injector.get to omit 'any' (#60202) |
| 338818ce89 | fix | Surface errors from ApplicationRef.tick
to callsite (#60102) |
forms
| Commit | Type | Description |
| -- | -- | -- |
| 81fe0536fd | fix | Make sure statusChanges is emitted (#57098) |
platform-browser
| Commit | Type | Description |
| -- | -- | -- |
| a980ac9a6a | refactor | Deprecate the HammerJS integration (#60257) |
platform-server
| Commit | Type | Description |
| -- | -- | -- |
| 0cff9a12d3 | fix | add missing peer dependency for rxjs
(#60308) |
router
| Commit | Type | Description |
| -- | -- | -- |
| 219f41d049 | fix | Prevent dangling promise rejections from internal navigations (#60162) |
| cae1fe519b | fix | update symbols (#60233) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="19.2.2"></a>