Skip to content

Commit

Permalink
nodejs_binaries tsc and tsc_wrapped_bin should not depend on @build_b…
Browse files Browse the repository at this point in the history
…azel_rules_typescript_tsc_wrapped_deps//:node_modules

BREAKING CHANGE:
If you don't have an npm dependency on `@bazel/typescript`, you may be missing libraries like protobufjs which are required at runtime.
Run `yarn add -D @bazel/typescript` or `npm install --save-dev @bazel/typescript` to fix.

Closes bazel-contrib#234

PiperOrigin-RevId: 206037532
  • Loading branch information
gregmagolan authored and alexeagle committed Jul 25, 2018
1 parent ed25ef3 commit 3642b65
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "jasmine_node_test
nodejs_binary(
name = "tsc",
entry_point = "typescript/lib/tsc.js",
node_modules = "@build_bazel_rules_typescript_tsc_wrapped_deps//:node_modules",
visibility = ["//internal:__subpackages__"],
)

Expand Down Expand Up @@ -73,7 +72,6 @@ nodejs_binary(
":tsc_wrapped",
],
entry_point = "build_bazel_rules_typescript/internal/tsc_wrapped/tsc_wrapped.js",
node_modules = "@build_bazel_rules_typescript_tsc_wrapped_deps//:node_modules",
templated_args = ["--node_options=--expose-gc"],
visibility = ["//visibility:public"],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _compile_action(ctx, inputs, outputs, tsconfig_file, node_opts, description

action_inputs = inputs + [
f
for f in ctx.files.node_modules + ctx.files._tsc_wrapped_deps
for f in ctx.files.node_modules
if f.path.endswith(".js") or f.path.endswith(".ts") or f.path.endswith(".json")
]
if ctx.file.tsconfig:
Expand Down Expand Up @@ -214,7 +214,6 @@ ts_library = rule(
),
"tsickle_typed": attr.bool(default = True),
"internal_testing_type_check_dependencies": attr.bool(default = False, doc = "Testing only, whether to type check inputs that aren't srcs."),
"_tsc_wrapped_deps": attr.label(default = Label("@build_bazel_rules_typescript_tsc_wrapped_deps//:node_modules")),
# @// is special syntax for the "main" repository
# The default assumes the user specified a target "node_modules" in their
# root BUILD file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def ts_setup_workspace():
package_json = "@build_bazel_rules_typescript//internal:tsc_wrapped/package.json",
yarn_lock = "@build_bazel_rules_typescript//internal:tsc_wrapped/yarn.lock",
)

yarn_install(
name = "build_bazel_rules_typescript_devserver_deps",
package_json = "@build_bazel_rules_typescript//internal/devserver:package.json",
Expand Down

0 comments on commit 3642b65

Please sign in to comment.