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.8 (2025-04-23)
Breaking Changes
compiler
- 'in' in an expression now refers to the operator
core
provideExperimentalZonelessChangeDetection
is
renamed to provideZonelessChangeDetection
as it is now "Developer
Preview" rather than "Experimental".
router
- The
RedirectFn
can now return Observable
or
Promise
. Any code that directly calls functions returning this type
may need to be adjusted to account for this.
- Several methods in the public API of the Router which
required writable arrays have now been updated to accept readonly
arrays when no mutations are done.
Deprecations
platform-server
compiler
| Commit | Type | Description |
| -- | -- | -- |
| 1b8e7ab9fe | feat | support the in
keyword in Binary expression (#58432) |
core
| Commit | Type | Description |
| -- | -- | -- |
| 953c4b2580 | feat | Move zoneless change detection to dev preview (#60748) |
| 0ac949c266 | fix | do not run change detection on global error events (#60944) |
| 0162ceb427 | fix | inject migration should treat @Attribute
as optional (#60916) |
forms
| Commit | Type | Description |
| -- | -- | -- |
| be995623cd | fix | make NgForm emit FormSubmittedEvent and FormResetEvent (#60887) |
platform-server
| Commit | Type | Description |
| -- | -- | -- |
| 2240a21c97 | refactor | deprecate the testing entry point (#60915) |
router
| Commit | Type | Description |
| -- | -- | -- |
| 62de7d930a | feat | add asynchronous redirects (#60863) |
| 2419060fef | fix | relax required types on router commands to readonly array (#60345) |
<!-- CHANGELOG SPLIT MARKER -->
<a name="19.2.8"></a>