Angular is continuing its efforts to improve and increase developer productivity with the introduction of Bazel as an opt-in preview in Angular CLI 8. Bazel, an open-source software tool provides automation of building and testing of software. This release will change Angular.js Web Application Development Services.
Bazel is not a new concept. Google has used Bazel internally for the past 12 years to build its large scale and massive applications such as Gmail, Google Drive and Google Cloud Console. Angular team has been burning the midnight oil to offer it as a developer option for the past two years. Angular 6, the framework itself has been developed with Bazel. Now as an option for developers in the CLI will allow using the same workflow and building faster.
“Bazel helps you scale your organization, codebase and Continuous Integration system. It handles codebases of any size, in multiple repositories or a huge monorepo,” the Bazel website states.
The main goal behind the latest release:
- Reduce the size of Bazel’s binary to improve its integration with the external Node.js ecosystem.
- Incremental changes, which effectively means that small changes to apps will require an equally proportional amount of rebuild and retest work.
- Better integration with npm, leading to significant improvement of the initial build time.
- Angular will continue to improve Bazel’s feature set in the CLI to support the set of Angular CLI features such as PWA, universal support and app shell; support for third-party modules; and performance improvements.
With properties such as hermeticity, parallelism, and incrementality, Bazel empowers fast builds, which are proportional to the changes, rebuilding artifacts affected by the updated files. It is important to hire AngularJs Developers to understand the functionality.
The Bazel Opt-In Preview Is Here
Here are some of the capabilities that you can expect if you try the opt-in preview:
- Production and development builds. Since Bazel enables the incrementality of the Angular compiler, for both production and development the Angular CLI will use Ahead-of-Time compilation.
- Unit testing with Karma, Jasmine and end-to-end testing with Protractor
Some of the limitations of the opt-in preview that we’re working on are:
- Supporting the complete set of features that the Angular CLI provides (PWA, universal support, app shell, etc)
- Support of third-party modules distributed without a UMD bundle. Currently, the development server of Bazel supports limited amount of module formats because of optimizations it does to speed up the page reloads in development. This constraint could be overcome using custom module loading configuration with require.js. In the future, we’ll work on supporting a wider range of module formats by default.
- Optimized for large applications with voluminous lines of coding such as hundreds of thousands of code lines. Work towards downsizing to support instantaneous builds for any project size.
How to opt-in
In order to use the opt-in preview of Bazel make sure you’re using Angular CLI version 8 or above.
- Try the Bazel integration with the Angular CLI with a new project.
- Go for a custom schematics collection.
- Upon creation of a new project with the Bazel schematics you and run ng serve or ng build the same way.
Here are few differences:
- ng build produces a production build by default
- The CLI will output the production assets
This is the first production build which may take a little longer than expected, until Bazel populates its cache. Bazel will also perform operations related to an ongoing effort for better interoperability with npm that we’re going to introduce soon.
The Angular team is determined to improve Bazel’s feature in the CLI and the team is already working on supporting the complete set of Angular CLI features mainly PWA, universal support and app shell; third-party modules support; and performance enhancements.