bazel-javascript icon indicating copy to clipboard operation
bazel-javascript copied to clipboard

Bazel-managed nodejs dependencies

Open gulrotkake opened this issue 7 years ago • 2 comments

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?

gulrotkake avatar Sep 25 '18 15:09 gulrotkake

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?

fwouts avatar Sep 26 '18 09:09 fwouts

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",
)

gulrotkake avatar Sep 26 '18 14:09 gulrotkake