Skip to content

Commit 242379f

Browse files
committed
fix(builtin): locations arg of npm_package_bin should result in separate argv
1 parent 4bacc48 commit 242379f

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

examples/app/BUILD.bazel

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@ load("@npm_bazel_typescript//:index.bzl", "ts_devserver", "ts_library")
99

1010
package(default_visibility = ["//visibility:public"])
1111

12-
_ASSETS = [
13-
":bundle.min",
14-
"//styles:base.css",
15-
"//styles:test.css",
16-
]
17-
1812
ts_library(
1913
name = "app",
2014
srcs = ["app.ts"],
2115
)
2216

2317
ts_devserver(
2418
name = "devserver",
25-
static_files = [":inject_tags"] + _ASSETS,
2619
# We'll collect all the devmode JS sources from these TypeScript libraries
2720
deps = [":app"],
2821
)
@@ -38,6 +31,12 @@ terser_minified(
3831
src = ":bundle",
3932
)
4033

34+
_ASSETS = [
35+
":bundle.min",
36+
"//styles:base.css",
37+
"//styles:test.css",
38+
]
39+
4140
# Copy index.html to the output folder, adding <script> and <link> tags
4241
html_insert_assets(
4342
name = "inject_tags",
@@ -49,7 +48,6 @@ html_insert_assets(
4948
"$(location :index.tmpl.html)",
5049
"--roots",
5150
"$@",
52-
] + [
5351
"--assets",
5452
] + ["$(locations %s)" % a for a in _ASSETS],
5553
data = [":index.tmpl.html"] + _ASSETS,

internal/node/npm_package_bin.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ def _impl(ctx):
5454
outputs = ctx.outputs.outs
5555

5656
for a in ctx.attr.args:
57-
args.add(_expand_location(ctx, a))
57+
# Workaround bazelbuild/bazel#10309
58+
# If one of the files has a space in the name, we will
59+
# incorrectly split it into multiple argv
60+
args.add_all(_expand_location(ctx, a).split(" "))
5861
run_node(
5962
ctx,
6063
executable = "tool",

0 commit comments

Comments
 (0)