blob: f81b1eb6d301b954876cade9c14ef0f34aeb01c4 [file]
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",
)
# For running this example as a bazel_integration_test
# See //examples:BUILD.bazel
filegroup(
name = "all_files",
srcs = glob(
include = ["**/*"],
exclude = [
"bazel-out/**/*",
"dist/**/*",
"node_modules/**/*",
],
),
visibility = ["//visibility:public"],
)