blob: 88cadab8e22105af126ed0015c978b33021d1b78 [file] [log] [blame]
Alex Perryb3168082022-01-22 13:36:13 -08001load("@npm//@bazel/typescript:index.bzl", "ts_project")
2load("//tools/build_rules:js.bzl", "rollup_bundle")
3load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver")
4load("@npm//@babel/cli:index.bzl", "babel")
5
6ts_project(
7 name = "app",
8 srcs = glob([
9 "*.ts",
10 "*.ng.html",
11 ]),
12 tsc = "@npm//@angular/compiler-cli/bin:ngc",
13 tsconfig = "//:tsconfig.json",
14 visibility = ["//visibility:public"],
15 deps = [
16 "@npm//@angular/animations",
17 "@npm//@angular/common",
18 "@npm//@angular/compiler",
19 "@npm//@angular/core",
20 "@npm//@angular/platform-browser",
21 ],
22)
23
24rollup_bundle(
25 name = "main_bundle",
26 entry_point = "main.ts",
27 deps = [
28 "app",
29 ],
30)
31
32babel(
33 name = "main_bundle_compiled",
34 args = [
35 "$(execpath :main_bundle)",
36 "--no-babelrc",
37 "--source-maps",
38 "--plugins=@angular/compiler-cli/linker/babel",
39 "--out-dir",
40 "$(@D)",
41 ],
42 data = [
43 ":main_bundle",
44 "@npm//@angular/compiler-cli",
45 ],
46 output_dir = True,
47)
48
49concatjs_devserver(
50 name = "devserver",
51 serving_path = "/main_bundle.js",
52 static_files = [
53 ":index.html",
54 "@npm//:node_modules/zone.js/dist/zone.min.js",
55 ],
56 deps = [":main_bundle_compiled"],
57)