Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion esbuild/private/esbuild.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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,
Expand Down
16 changes: 11 additions & 5 deletions examples/plugins/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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
Expand Down