-
Notifications
You must be signed in to change notification settings - Fork 24.8k
/
BUILD.bazel
82 lines (74 loc) 路 2 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package(default_visibility = ["//visibility:public"])
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm//http-server:index.bzl", "http_server")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
# Allow targets under sub-packages to reference the tsconfig.json file
exports_files(["tsconfig.json"])
ng_module(
name = "src",
srcs = glob(["*.ts"]),
deps = [
"//src/hello-world",
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/platform-browser",
"@npm//@angular/router",
"@npm//@types",
"@npm//rxjs",
],
)
filegroup(
name = "rxjs_umd_modules",
srcs = [
# do not sort
"@npm//:node_modules/rxjs/bundles/rxjs.umd.js",
":rxjs_shims.js",
],
)
ts_devserver(
name = "devserver",
entry_module = "bazel_integration_test/src/main",
index_html = "index.html",
scripts = [
":rxjs_umd_modules",
],
serving_path = "/bundle.min.js",
static_files = [
"@npm//:node_modules/zone.js/dist/zone.min.js",
],
deps = ["//src"],
)
rollup_bundle(
name = "bundle",
enable_code_splitting = False,
entry_point = ":main.ts",
deps = [
"//src",
# TODO(kyliau): These are not necessary. Bundle compiles fine without
# these deps.
# "@npm//@angular/common",
# "@npm//@angular/core",
# "@npm//@angular/platform-browser",
"@npm//@angular/router", # needed here due to additional imports generated by ngc
"@npm//rxjs",
],
)
web_package(
name = "prodapp",
assets = [
# do not sort
"@npm//:node_modules/zone.js/dist/zone.min.js",
":bundle.min.js",
],
data = [
":bundle",
],
index_html = "index.html",
)
http_server(
name = "prodserver",
data = [":prodapp"],
templated_args = ["src/prodapp"],
)