blob: c22ea38e3eb2d5aec92644139ceaf25eb17db845 [file] [log] [blame]
Philipp Schrader54047962022-02-16 21:05:11 -08001load("@npm//@bazel/typescript:index.bzl", "ts_library")
Alex Perryb3168082022-01-22 13:36:13 -08002load("//tools/build_rules:js.bzl", "rollup_bundle")
3load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver")
4load("@npm//@babel/cli:index.bzl", "babel")
5
Philipp Schrader54047962022-02-16 21:05:11 -08006ts_library(
Alex Perryb3168082022-01-22 13:36:13 -08007 name = "app",
8 srcs = glob([
9 "*.ts",
Philipp Schrader54047962022-02-16 21:05:11 -080010 ]),
11 angular_assets = glob([
Alex Perryb3168082022-01-22 13:36:13 -080012 "*.ng.html",
13 ]),
Philipp Schrader54047962022-02-16 21:05:11 -080014 compiler = "//tools:tsc_wrapped_with_angular",
15 target_compatible_with = ["@platforms//cpu:x86_64"],
16 use_angular_plugin = True,
Alex Perryb3168082022-01-22 13:36:13 -080017 visibility = ["//visibility:public"],
18 deps = [
19 "@npm//@angular/animations",
20 "@npm//@angular/common",
Alex Perryb3168082022-01-22 13:36:13 -080021 "@npm//@angular/core",
22 "@npm//@angular/platform-browser",
23 ],
24)
25
26rollup_bundle(
27 name = "main_bundle",
28 entry_point = "main.ts",
29 deps = [
30 "app",
31 ],
32)
33
34babel(
35 name = "main_bundle_compiled",
36 args = [
37 "$(execpath :main_bundle)",
38 "--no-babelrc",
39 "--source-maps",
40 "--plugins=@angular/compiler-cli/linker/babel",
41 "--out-dir",
42 "$(@D)",
43 ],
44 data = [
45 ":main_bundle",
46 "@npm//@angular/compiler-cli",
47 ],
48 output_dir = True,
49)
50
51concatjs_devserver(
52 name = "devserver",
53 serving_path = "/main_bundle.js",
54 static_files = [
55 ":index.html",
56 "@npm//:node_modules/zone.js/dist/zone.min.js",
57 ],
58 deps = [":main_bundle_compiled"],
59)