bazel-javascript
bazel-javascript copied to clipboard
Bazel-managed nodejs dependencies
Any plans to support the dependency management repository rules provided by bazelbuild/rules_nodejs?
Ie, something like:
ts_library(
name = "src",
srcs = glob([
"*.tsx",
]),
tsconfig = "//web:tsconfig.json",
deps = [
"@npm//:typescript",
"@npm//:react",
],
tags = ["block-network"],
)
instead of using the npm_packages rule?
Hi Michael, not exactly. However you may be interested in the discussion happening in https://github.com/zenclabs/bazel-javascript/issues/19.
In the above example, how would you specify which exact version of typescript, react and all of their dependencies to use, to make sure builds are completely reproducible?
Hi François,
thanks for the reply, #19 was indeed an interesting discussion and puts the complexity of the issue a bit more into perspective :).
As for my example above, the versions of typescript and react are specified in a yarn.lock file, which is included in the workspace as such:
load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)