| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") |
| load(":uses_workers.bzl", "work") |
| |
| # This is our program that we want to run as a worker |
| # Imagine that it takes a long time to start, or benefits from caching work |
| nodejs_binary( |
| name = "tool", |
| # For the integration test, allow a second bazel build |
| # to explicitly be a cache miss, letting us test both |
| # worker and standalone modes. |
| configuration_env_vars = ["cache_bust"], |
| data = ["@npm//@bazel/worker"], |
| entry_point = ":tool.js", |
| ) |
| |
| # How a user would call our rule that uses workers. |
| work( |
| name = "do_work", |
| src = "foo.js", |
| ) |