diff --git a/esbuild/private/esbuild.bzl b/esbuild/private/esbuild.bzl index 0af1158..7ed5fe2 100644 --- a/esbuild/private/esbuild.bzl +++ b/esbuild/private/esbuild.bzl @@ -336,6 +336,7 @@ def _esbuild_impl(ctx): # setup the args passed to the launcher launcher_args = ctx.actions.args() other_inputs = [] + config_deps = [] args_file = write_args_file(ctx, args) other_inputs.append(args_file) @@ -356,6 +357,7 @@ def _esbuild_impl(ctx): if ctx.attr.config: config_bin_copy = copy_file_to_bin_action(ctx, ctx.file.config) other_inputs.append(config_bin_copy) + config_deps.append(ctx.attr.config) launcher_args.add("--config_file=%s" % _bin_relative_path(ctx, config_bin_copy)) # stamp = ctx.attr.node_context_data[NodeContextInfo].stamp @@ -373,7 +375,7 @@ def _esbuild_impl(ctx): if not (file.path.endswith(".d.ts") or file.path.endswith(".tsbuildinfo")) ]) + entry_points_bin_copy + [tsconfig_bin_copy] + other_inputs + node_toolinfo.tool_files + esbuild_toolinfo.tool_files, transitive = [js_lib_helpers.gather_files_from_js_infos( - targets = ctx.attr.srcs + ctx.attr.deps, + targets = ctx.attr.srcs + ctx.attr.deps + config_deps, include_sources = True, include_types = False, include_transitive_sources = True, diff --git a/examples/plugins/BUILD.bazel b/examples/plugins/BUILD.bazel index 9adfbe2..51088bd 100644 --- a/examples/plugins/BUILD.bazel +++ b/examples/plugins/BUILD.bazel @@ -1,15 +1,21 @@ load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild") +load("@aspect_rules_js//js:defs.bzl", "js_library") load("@esbuild_plugins//:defs.bzl", "npm_link_all_packages") npm_link_all_packages(name = "node_modules") -esbuild( - name = "bundle", - srcs = [ - "logo.svg", +js_library( + name = "config", + srcs = ["esbuild.config.mjs"], + deps = [ ":node_modules/esbuild-plugin-svg", ], - config = "esbuild.config.mjs", +) + +esbuild( + name = "bundle", + srcs = ["logo.svg"], + config = ":config", entry_point = "main.js", # using the select statement will download toolchains for all three platforms in an unconfigured build (e.g. query rather than cquery) # you can also just provide an individual toolchain if you don't want to download them all