Skip to content

Commit

Permalink
fix: npm_umd_bundle looks for LinkablePackageInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Oct 5, 2021
1 parent 159e18a commit 6414f3f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/npm_install/npm_umd_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
For use by yarn_install and npm_install. Not meant to be part of the public API.
"""

load("//:providers.bzl", "DirectoryFilePathInfo", "ExternalNpmPackageInfo", "node_modules_aspect")
load("//:providers.bzl", "DirectoryFilePathInfo", "ExternalNpmPackageInfo", "LinkablePackageInfo", "node_modules_aspect")
load("//internal/common:maybe_directory_file_path.bzl", "maybe_directory_file_path")

def _entry_point_path(ctx):
Expand All @@ -43,14 +43,18 @@ def _impl(ctx):
args.add(output.path)
args.add_joined(ctx.attr.excluded, join_with = ",")

sources = ctx.attr.package[ExternalNpmPackageInfo].sources.to_list()
if ExternalNpmPackageInfo in ctx.attr.package:
sources = ctx.attr.package[ExternalNpmPackageInfo].sources.to_list()
else:
sources = ctx.attr.package[LinkablePackageInfo].files.to_list()

# Only pass .js and package.json files as inputs to browserify.
# The latter is required for module resolution in some cases.
# We have to pass entire directories as well, since we don't know if they contain .js files
inputs = [
f
for f in sources
if f.path.endswith(".js") or f.path.endswith(".json")
if f.path.endswith(".js") or f.path.endswith(".json") or f.is_directory
]

ctx.actions.run(
Expand Down

0 comments on commit 6414f3f

Please sign in to comment.