blob: c22ea38e3eb2d5aec92644139ceaf25eb17db845 [file] [log] [blame]
load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("//tools/build_rules:js.bzl", "rollup_bundle")
load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver")
load("@npm//@babel/cli:index.bzl", "babel")
ts_library(
name = "app",
srcs = glob([
"*.ts",
]),
angular_assets = glob([
"*.ng.html",
]),
compiler = "//tools:tsc_wrapped_with_angular",
target_compatible_with = ["@platforms//cpu:x86_64"],
use_angular_plugin = True,
visibility = ["//visibility:public"],
deps = [
"@npm//@angular/animations",
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/platform-browser",
],
)
rollup_bundle(
name = "main_bundle",
entry_point = "main.ts",
deps = [
"app",
],
)
babel(
name = "main_bundle_compiled",
args = [
"$(execpath :main_bundle)",
"--no-babelrc",
"--source-maps",
"--plugins=@angular/compiler-cli/linker/babel",
"--out-dir",
"$(@D)",
],
data = [
":main_bundle",
"@npm//@angular/compiler-cli",
],
output_dir = True,
)
concatjs_devserver(
name = "devserver",
serving_path = "/main_bundle.js",
static_files = [
":index.html",
"@npm//:node_modules/zone.js/dist/zone.min.js",
],
deps = [":main_bundle_compiled"],
)