fwouts / bazel-javascript

JavaScript and TypeScript rules for Bazel (React friendly)
MIT License
65 stars 17 forks source link

Bazel-managed nodejs dependencies #26

Open gulrotkake opened 6 years ago

gulrotkake commented 6 years ago

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?

fwouts commented 6 years ago

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?

gulrotkake commented 6 years ago

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