Many companies are successfully building with rules_js.
If you're getting value from the project, please let us know!
Just comment on our Adoption Discussion.
Using Bzlmod with Bazel 6:
Add to your MODULE.bazel
file:
bazel_dep(name = "aspect_rules_js", version = "2.5.0")
####### Node.js version #########
# By default you get the node version from DEFAULT_NODE_VERSION in @rules_nodejs//nodejs:repositories.bzl
# Optionally you can pin a different node version:
bazel_dep(name = "rules_nodejs", version = "6.3.0")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
node.toolchain(node_version = "16.14.2")
#################################
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
# Allows developers to use the matching pnpm version, for example:
# bazel run -- @pnpm --dir /home/runner/work/rules_js/rules_js install
use_repo(pnpm, "pnpm")
Using WORKSPACE
Paste this snippet into your WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "aspect_rules_js",
sha256 = "17c5964f6a4507488c2ce99ebd493ee111da5d5cab85ca99119eaae331d38989",
strip_prefix = "rules_js-2.5.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.5.0/rules_js-v2.5.0.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
What's Changed
- feat: update c8 to latest by @Mivr in #2304
- test: upgrade github.com/ash2k/bazel-tools to rules_multirun by @jbedard in #2307
- chore: upgrade aspect_tools_telemetry to 0.2.5 by @jbedard in #2310
- chore(deps): Bump tools_telemetry by @arrdem in #2312
- feat: add action environment variables to RunEnvironmentInfo by @Mivr in #2303
- js_image_layer allow configurable directory/file permissions by @justinswe in #2313
- fix: don't use version 0.0.0 by @alexeagle in #2320
- chore: update tools_telemetry to 0.2.8 by @jbedard in #2323
- chore(deps): update actions/checkout action to v5 by @renovate[bot] in #2301
- fix: indeterministic node-gyp makefile that is only used during install hook by @joeljeske in #2321
- Update config.yaml by @alexeagle in #2324
- fix(js_run_devserver): do not output run--watch EXIT errors by default by @jbedard in #2326
New Contributors
- @justinswe made their first contribution in #2313
- @joeljeske made their first contribution in #2321
Full Changelog: v2.4.2...v2.5.0