Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(builtin): fix a bug where mjs entry points were not added to runfiles #3406

Merged
merged 1 commit into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, this should have been our clue

"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",
)