What is @angular-devkit/build-angular?
The @angular-devkit/build-angular package is a set of tools and build configurations used to compile and build Angular applications. It is part of the Angular DevKit and is designed to work with the Angular CLI to provide a smooth development experience. It includes features for building, bundling, optimizing, and serving Angular applications.
What are @angular-devkit/build-angular's main functionalities?
Building Angular Applications
Compiles an Angular app into an output directory. The build artifacts will be stored in the dist/ directory by default.
ng build
Development Server
Builds the application and starts a web server. You can view your application in the browser by navigating to the provided localhost address.
ng serve
Code Optimization
Performs ahead-of-time compilation, tree-shaking, minification, and other optimizations to produce a production-ready application.
ng build --prod
Sass/SCSS Compilation
Allows you to use Sass/SCSS stylesheets with your Angular components, which will be compiled to CSS during the build process.
ng build --style=scss
Internationalization (i18n)
Builds the application with i18n support. It can generate multiple versions of your application, one for each locale you support.
ng build --localize
Other packages similar to @angular-devkit/build-angular
webpack
Webpack is a powerful module bundler that can be used for building Angular applications. It is more generic than @angular-devkit/build-angular and can be used with various frameworks and libraries. It requires more configuration but is highly customizable.
parcel-bundler
Parcel is a fast, zero-configuration web application bundler that can also be used with Angular. It is simpler to set up than Webpack but may not offer the same level of control for complex build configurations.
rollup
Rollup is a module bundler for JavaScript that compiles small pieces of code into something larger and more complex, such as a library or application. It is known for its tree-shaking capabilities and is often used for building libraries. It can be used with Angular but is not as integrated as @angular-devkit/build-angular.
gulp
Gulp is a toolkit for automating painful or time-consuming tasks in your development workflow. While it can be used to build Angular applications, it is more of a task runner than a specialized Angular build tool and requires more setup for Angular-specific tasks.
@angular-devkit/build-angular
This package contains Architect builders used to build and test Angular applications and libraries.
Builders
Name | Description |
---|
application | Build an Angular application targeting a browser and server environment using esbuild. |
app-shell | Build an Angular App shell. |
browser | Build an Angular application targeting a browser environment using Webpack. |
browser-esbuild | Build an Angular application targeting a browser environment using esbuild. |
dev-server | A development server that provides live reloading. |
extract-i18n | Extract i18n messages from an Angular application. |
karma | Execute unit tests using Karma test runner. |
ng-packagr | Build and package an Angular library in Angular Package Format (APF) format using ng-packagr. |
prerender | Prerender pages of your application. Prerendering is the process where a dynamic page is processed at build time generating static HTML. |
server | Build an Angular application targeting a Node.js environment. |
ssr-dev-server | A development server which offers live reload during development, but uses server-side rendering. |
protractor | Deprecated - Run end-to-end tests using Protractor framework. |
Disclaimer
While the builders when executed via the Angular CLI and their associated options are considered stable, the programmatic APIs are not considered officially supported and are not subject to the breaking change guarantees of SemVer.
19.0.0-next.2 (2024-08-28)
Breaking Changes
@angular/ssr
-
The CommonEngine
API now needs to be imported from @angular/ssr/node
.
Before
import { CommonEngine } from '@angular/ssr';
After
import { CommonEngine } from '@angular/ssr/node';
@schematics/angular
| Commit | Type | Description |
| --------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------- |
| a381a3db1 | feat | add option to export component as default |
@angular/ssr
| Commit | Type | Description |
| --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------------------- |
| 30c25bf68 | feat | export AngularAppEngine
as public API |
| 4b09887a9 | feat | move CommonEngine
API to /node
entry-point |
| d43180af5 | fix | add missing peer dependency on @angular/platform-server
|
<!-- CHANGELOG SPLIT MARKER -->
<a name="17.3.9"></a>