Bazel rules for JavaScript

High-performance Bazel rules for running Node.js tools and building JavaScript projects

setting icon


Only fetch and link npm packages needed for the requested targets

check icon


Works seamlessly with Node.js module resolution

zap icon


Parallelize your Node.js build with fine grained targets and remote execution

code icon

Supports npm workspaces

Nested npm packages in a monorepo

Faster and more compatible

rules_js is a faster and more compatible approach to integrating JavaScript build, test, and release tooling under Bazel, compared with the earlier rules_nodejs

rules_js solves these problems

rules_js solves many of the problems that node_js users have endured, including:

alert icon

Too slow to run a full package manager install whenever a file like package.json changes

alert icon

Having separate source and output folders breaks expectations of Node.js tooling. For example, TypeScript required a tricky rootDirs setting to resolve everything

alert icon

No support for "workspaces" so every package.json had to be independently installed

alert icon

Performance: treating npm packages as directories rather than thousands of files was bolted-on late in rules_nodejs and hard to adopt

rules_js documentation

See the documentation for rules_js on our Bazel rules doc site

Try out examples for Angular, React, Next.js, NextJS and more

Migration guide

A step-by-step guide for migrating to rules_js

Expert help is a click away

Aspect Development, our professional services division, is here to help make your Bazel migration a success. Come find us at

Aspect CLI makes it easy for developers to diagnose their broken build by asking for help directly within their terminal session.