Skip to content

0.18.4

Compare
Choose a tag to compare
@alexeagle alexeagle released this 08 Feb 21:13

MAJOR CHANGE

This is the first rules_nodejs release that uses a distribution artifact.

You should no longer fetch the entire GitHub repository with one of

git_repository(
    name = "build_bazel_rules_nodejs",
    remote = "https://github.com/bazelbuild/rules_nodejs.git",
    tag = "0.18.0"
)
# or
http_archive(
    name = "build_bazel_rules_nodejs",
    urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.16.8.zip"],
    strip_prefix = "rules_nodejs-0.16.8",
)

Instead, fetch our distribution tar.gz file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "build_bazel_rules_nodejs",
    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.18.4/rules_nodejs-0.18.4.tar.gz"],
    sha256 = "23987a5cf549146742aa6a0d2536e4906906e63a608d5b9b32dd9fe5523ef51c",
)

We did this for a few reasons:

  1. It's wasteful for users to download all our tests, examples, and any large files we vendor into our repo.
  2. We cannot trust the sha256 produced by the GitHub frontend to be stable.
  3. We want to start authoring our files in TypeScript, but you should only get JavaScript files. Bazel support for transitive dependencies is weak and hard for users to manage.

Note, this is not a breaking change, you could still fetch the entire repo, emulating a monorepo scheme across multiple repositories, and building everything from source. However we discourage that since it exposes our transitive development-only dependencies like TypeScript.

Other changes

** Breaking change **: if you depended on our internal file, @build_bazel_rules_nodejs//internal:node.bzl, this has been removed. You should now depend on individual files which were re-exported from there.

We have updated our examples. There is a new example of using Parcel.js, to illustrate using an arbitrary npm library in your toolchain. There is also an example of building a web application with Rollup, and injected script and link tags in the index.html.