✨ Bazel updates for March

✨ Bazel updates for March

thekiba

Hello everyone 🙌🏻

Let me share with you our monthly Bazel updates!

⚡️ Faster builds

Previously, using Bazel required building dependencies from sources, such as Angular itself, Material components, and so on. This took a lot of memory and time for the initial build.

We now build Angular applications following the same standard development workflow you’re used to:

  • Install dependencies from npm
  • Add Angular compiler outputs during the build
  • Compile just your source files

👨🏻‍🔧 Better support in Angular CLI

  • You can add Bazel to your existing project with ng add @angular/bazel@next. The Bazel builder supports CLI applications using the standard build capabilities. For lazy-loading support, you should eject (see below) and alter the functionality.
  • Bazel files (WORKSPACE, BUILD.bazel, etc) are now hidden by default. This makes the transition to Bazel less confusing for users who are new to Bazel. Familiar CLI commands like ng build would continue to work as before.
  • For users who want more control over Bazel configuration, Bazel files could be exposed by running ng build --leaveBazelFilesOnDisk.
  • Unlike the old workflow, ng build under Bazel would produce a prod bundle by default.

🧪 Bazel examples

  • We’ve been working on improving the Bazel example. We introduced differential loading and more robust lazy-loading mechanism using dynamic imports
  • We built a demo of the Angular Real World Example application with Bazel

✨ Tips and tricks

Consuming non-UMD bundles in development

In the example applications, you might have noticed that we’re using UMD bundles in ts_devserver. Frequently we get asked how to use non-UMD bundles. You can achieve this with requirejs. For sample configuration, check this link. Currently, we’re working on a more robust way for consumption of non-UMD dependencies.

How would RBE help me?

We got about 80% improvement of the build time of our CI in the Angular repository after switching to Remote Build Execution. If you want to experiment with RBE yourself, respond directly to this email so we can connect you with the RBE team.

That was all for this month, see you in April!

Best regards,

Minko


Report Page