
Tooling
This guide uses a combination of Bazel modules and performance-optimized tools.Bazel modules
The following modules form the foundation of the JavaScript toolchain within Bazel:- Runtime environment — The
rules_nodejsmodule supplies a fully isolatednode.jstoolchain, both for running build tools and for server application runtimes. - JavaScript rules and package management — The
aspect_rules_jsmodule translates a pnpm lockfile into Bazel targets and supplies the basic rules for building, testing, packaging, and running JavaScript code. - TypeScript support — The
aspect_rules_tsmodule adds type-checking and transpilation to JavaScript.
rules_js features used in this course
You will use rules_js at each layer of the application:
npm_translate_lockturns the pnpm lockfile into the external@npmrepository, whilenpm_link_all_packagesgives each workspace package a strict, package-localnode_modulestarget.js_binaryruns an entry point with Bazel’s hermetic Node.js toolchain and a declared set of runtime files.- Generated npm
binmacros expose tools such as Vite as ordinary Bazel executables. js_librarycarries JavaScript sources and generated outputs through the build graph, whilenpm_packageassembles an npm-compatible package tree.js_run_devserverkeeps a development server alive, synchronizes declared files into its sandbox, and cooperates with iBazel for watch mode.
Performance optimized build tools
Bazel works with virtually any JavaScript tooling. However, you will experience the best performance with tools that have minimal startup time. This guide uses Rust-based tools where it can:- SWC: A fast Rust-based tool for transpiling JavaScript/TypeScript. The starter repository uses it for
ts_projecttargets, leavingtscto type-check only. - Vite: A modern development server that provides a fast development experience.
The native Go port of the TypeScript compiler ships as TypeScript 7.
aspect_rules_ts3.9.0 and later can run the TypeScript 7 release candidate, so type-checking gets faster without changing yourBUILDfiles.
Development experience
Finally, install the Aspect CLI to improve the terminal workflow. It makes Bazel easier to use by providing a familiar task-runner interface similar topackage.json scripts.
Next, you’ll build a basic Node.js application with Bazel.

Delivered by Zipline
Sponsorship for development of this training course was provided by Zipline.
Thank you!

