diff --git a/packages/rollup/src/rollup_bundle.bzl b/packages/rollup/src/rollup_bundle.bzl index d41d333746..e15d974ca1 100644 --- a/packages/rollup/src/rollup_bundle.bzl +++ b/packages/rollup/src/rollup_bundle.bzl @@ -178,6 +178,14 @@ Otherwise, the outputs are assumed to be a single file. cfg = "host", default = "@npm//rollup/bin:rollup", ), + "silent": attr.bool( + doc = """Whether to execute the rollup binary with the --silent flag, defaults to False. + +Using --silent can cause rollup to [ignore errors/warnings](https://github.com/rollup/rollup/blob/master/docs/999-big-list-of-options.md#onwarn) +which are only surfaced via logging. Since bazel expects printing nothing on success, setting silent to True +is a more Bazel-idiomatic experience, however could cause rollup to drop important warnings. +""", + ), "sourcemap": attr.string( doc = """Whether to produce sourcemaps. @@ -316,6 +324,10 @@ def _rollup_bundle(ctx): args.add_all(["--format", ctx.attr.format]) + if ctx.attr.silent: + # Run the rollup binary with the --silent flag + args.add("--silent") + stamp = ctx.attr.node_context_data[NodeContextInfo].stamp config = ctx.actions.declare_file("_%s.rollup_config.js" % ctx.label.name)