Skip to content

Commit

Permalink
fix(builtin): fix a bug where mjs entry points were not added to (#3406)
Browse files Browse the repository at this point in the history
runfiles
  • Loading branch information
kormide authored Apr 14, 2022
1 parent e3cdce3 commit e24473c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions internal/node/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ a `module_name` attribute can be `require`d by that name.
load("@rules_nodejs//nodejs:providers.bzl", "DirectoryFilePathInfo", "JSModuleInfo", "UserBuildSettingInfo")
load("//:providers.bzl", "ExternalNpmPackageInfo", "JSNamedModuleInfo", "NodeRuntimeDepsInfo", "node_modules_aspect")
load("//internal/common:expand_into_runfiles.bzl", "expand_location_into_runfiles")
load("//internal/common:is_js_file.bzl", "is_javascript_file")
load("//internal/common:maybe_directory_file_path.bzl", "maybe_directory_file_path")
load("//internal/common:module_mappings.bzl", "module_mappings_runtime_aspect")
load("//internal/common:path_utils.bzl", "strip_external")
Expand Down Expand Up @@ -361,8 +362,8 @@ if (process.cwd() !== __dirname) {
executable = ctx.outputs.launcher_sh

# syntax sugar: allows you to avoid repeating the entry point in data
# entry point is only needed in runfiles if it is a .js file
if len(ctx.files.entry_point) == 1 and ctx.files.entry_point[0].extension == "js":
# entry point is only needed in runfiles if it is a javascript file
if len(ctx.files.entry_point) == 1 and is_javascript_file(ctx.files.entry_point[0]):
runfiles.extend(ctx.files.entry_point)

return [
Expand Down
2 changes: 0 additions & 2 deletions internal/node/test/esm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
nodejs_binary(
name = "has_deps",
data = [
"has-deps.mjs",
"@fine_grained_deps_yarn//typescript",
],
entry_point = ":has-deps.mjs",
)

nodejs_binary(
name = "no_deps",
data = ["no-deps.mjs"],
entry_point = ":no-deps.mjs",
)

0 comments on commit e24473c

Please sign in to comment.