Skip to content

Migrating to 5.0

Alex Eagle edited this page Dec 23, 2021 · 21 revisions

rules_nodejs dependencies

Prior to 5.0, the build_bazel_rules_nodejs workspace had zero starlark dependencies, because transitive handling of them in WORKSPACE was so difficult for users to get right. However now that Bazel 5.0 has bzlmod to manage these transitive dependencies, we feel it's the right time to add dependencies. (Documentation for using rules_nodejs with bzlmod will be added soon)

You need to update your WORKSPACE file to install the dependencies. Note that WORKSPACE ordering is critical, so if you need to override versions of rules_nodejs dependencies, you must do it before this code.

load("@build_bazel_rules_nodejs//nodejs:repositories.bzl", "rules_nodejs_dependencies")

rules_nodejs_dependencies()

Next, you can remove usage of node_repositories, which is now deprecated.

load("@build_bazel_rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains", "rules_nodejs_dependencies")

nodejs_register_toolchains( # You can choose whatever name you like for the node toolchains, or register more than one version. name = "nodejs", )


## Users of vendored_yarn

You'll have to continue using `node_repositories` for now. Follow https://github.com/bazelbuild/rules_nodejs/issues/3175 for a migration path.

## Users of "user managed dependencies"

You`ll have to continue using `node_repositories` for now. We would like to remove this feature. Please tell us in https://github.com/bazelbuild/rules_nodejs/issues/3176 if you still rely on it.

# Moved

## packages/angular

`@bazel/angular` is a minimal plugin for the Angular CLI builders system (aka. architect) teaching the `ng` command how to spawn `bazel` for build and test steps.

It has been moved from this repo and can now be found in https://github.com/just-jeb/angular-builders
Thanks to @just-jeb for taking on maintenance of this code!

## ts_library

The `ts_library` rule is now in the `@bazel/concatjs` package.

# Reduced maintenance scope

The concatjs package is now in "maintenance mode". Since no one from Google participates in rules_nodejs, it has been impossible for us to keep this code up-to-date with what Google develops internally, and it is a complex package that OSS maintainers don't have time for.



Clone this wiki locally