rules_js icon indicating copy to clipboard operation
rules_js copied to clipboard

[Bug]: Issue bundling `js_binary` into a tar

Open njlr opened this issue 1 month ago • 0 comments

What happened?

Note I was unsure whether to put this into rules_js or tar.bzl.

Attempting to bundle this:

load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//:xlsx-cli/package_json.bzl", xlsx_cli_bin = "bin")
load("@tar.bzl", "tar")

npm_link_all_packages(
  name = "node_modules",
)

xlsx_cli_bin.xlsx_cli_binary(
  name = "xlsx_cli",
)

tar(
  name = "xlsx_cli_archive",
  srcs = [
    ":xlsx_cli",
  ],
)

Gives:

tar: Error reading archive bazel-out/k8-fastbuild/bin/xlsx_cli_archive_mtree.txt: mtree specification has different type for xlsx_cli_/xlsx_cli.runfiles/_main/node_modules/.aspect_rules_js/@cdn.sheetjs.com+xlsx-cli+xlsx-cli-1.1.4.tgz/node_modules/commander

Full repro: https://github.com/njlr/rules_js_tar_repro

Version

Development (host) and target OS/architectures:

Output of bazel --version: 8.4.2

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file:

"""rules_js_tar_repro"""

bazel_dep(name = "aspect_rules_js", version = "2.2.0")
bazel_dep(name = "tar.bzl", version = "0.6.0")

npm = use_extension(
  "@aspect_rules_js//npm:extensions.bzl",
  "npm",
  dev_dependency = True,
)

npm.npm_translate_lock(
  name = "npm",
  pnpm_lock = "//:pnpm-lock.yaml",
  verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")

Language(s) and/or frameworks involved:

tar.bzl

How to reproduce

See https://github.com/njlr/rules_js_tar_repro

Any other information?

Might be an issue with tar.bzl?

njlr avatar Nov 11 '25 08:11 njlr