Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(esbuild): default log-level flag to warning, unless overridden #2664

Merged
merged 1 commit into from
May 11, 2021
Merged
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
15 changes: 13 additions & 2 deletions packages/esbuild/esbuild.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def _esbuild_impl(ctx):
args.add("--preserve-symlinks")
args.add_joined(["--platform", ctx.attr.platform], join_with = "=")
args.add_joined(["--target", ctx.attr.target], join_with = "=")
args.add_joined(["--log-level", "info"], join_with = "=")
args.add_joined(["--metafile", metafile.path], join_with = "=")
args.add_all(ctx.attr.define, format_each = "--define:%s")
args.add_all(ctx.attr.external, format_each = "--external:%s")
Expand Down Expand Up @@ -111,7 +110,19 @@ def _esbuild_impl(ctx):
args.add_joined(["--tsconfig", jsconfig_file.path], join_with = "=")
inputs.append(jsconfig_file)

args.add_all([ctx.expand_location(arg) for arg in ctx.attr.args])
log_level_flag = "--log-level"
has_log_level_flag = False
for arg in ctx.attr.args:
if arg.startswith(log_level_flag):
has_log_level_flag = True

args.add(ctx.expand_location(arg))

# by default the log level is "info" and includes an output file summary
# under bazel this is slightly redundant and may lead to spammy logs
# unless the user overrides the log level, set it to only show warnings and errors
if not has_log_level_flag:
args.add_joined([log_level_flag, "warning"], join_with = "=")

env = {}
if ctx.attr.max_threads > 0:
Expand Down
7 changes: 6 additions & 1 deletion packages/esbuild/test/splitting/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ ts_library(

esbuild(
name = "bundle",
args = ["--keep-names"],
args = [
# info log level may be helpful when splitting as esbuild will show each file emitted
# where as bazel will only list the output directory
"--log-level=info",
"--keep-names",
],
entry_point = "main.ts",
output_dir = True,
deps = [":main"],
Expand Down