diff --git a/examples/genrule/BUILD.bazel b/examples/genrule/BUILD.bazel index dd176bb965..24b922a956 100644 --- a/examples/genrule/BUILD.bazel +++ b/examples/genrule/BUILD.bazel @@ -31,13 +31,12 @@ genrule( name = "call_acorn", srcs = [ ":one.js", - # reference the location where the "acorn" npm package was linked in our root Bazel package. - "//:node_modules/acorn", "//:node_modules/acorn/dir", ], outs = ["out1"], cmd = " ".join([ "$(NODE_PATH)", + # reference the location where the "acorn" npm package was linked in the rules_js npm package store. "./$(execpath //:node_modules/acorn/dir)/bin/acorn", "--compact", "$(execpath :one.js)", @@ -69,7 +68,6 @@ genrule( ":require_acorn_js", # reference the location where the "acorn" npm package was linked in our root Bazel package. "//:node_modules/acorn", - "//:node_modules/acorn/dir", ], outs = ["out2"], cmd = """ diff --git a/npm/private/npm_link_package_store.bzl b/npm/private/npm_link_package_store.bzl index f523bca704..2af66d9b00 100644 --- a/npm/private/npm_link_package_store.bzl +++ b/npm/private/npm_link_package_store.bzl @@ -92,7 +92,7 @@ def _npm_link_package_store_impl(ctx): ) files.append(bin_file) - files_depset = depset(files) + files_depset = depset(files, transitive = [store_info.files]) transitive_files_depset = depset(files, transitive = [store_info.transitive_files]) diff --git a/npm/private/test/npm_package/BUILD.bazel b/npm/private/test/npm_package/BUILD.bazel index c671cc78a2..a50110805f 100644 --- a/npm/private/test/npm_package/BUILD.bazel +++ b/npm/private/test/npm_package/BUILD.bazel @@ -22,7 +22,19 @@ js_library( npm_package( name = "pkg", - srcs = [":lib_a"], + srcs = [ + ":lib_a", + ], + visibility = ["//visibility:public"], +) + +npm_package( + name = "pkg_2", + srcs = [ + ":lib_a", + ":node_modules/chalk", # should be excluded + "//:node_modules/chalk", # should be excluded + ], visibility = ["//visibility:public"], ) @@ -40,6 +52,12 @@ diff_test( file2 = ":expected_pkg", ) +diff_test( + name = "test_pkg_2", + file1 = ":pkg_2", + file2 = ":expected_pkg", +) + npm_package( name = "pkg_with_node_modules", srcs = [":lib_a"],