1
1
package (default_visibility = ["//visibility:public" ])
2
2
3
3
load ("@angular//:index.bzl" , "ng_module" )
4
+ load ("@build_bazel_rules_nodejs//:defs.bzl" , "http_server" , "nodejs_binary" , "rollup_bundle" )
5
+ load ("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl" , "web_package" )
6
+ load ("@build_bazel_rules_typescript//:defs.bzl" , "ts_devserver" )
4
7
5
8
# Allow targets under sub-packages to reference the tsconfig.json file
6
9
exports_files (["tsconfig.json" ])
@@ -14,29 +17,34 @@ ng_module(
14
17
"@npm//@angular/core" ,
15
18
"@npm//@angular/platform-browser" ,
16
19
"@npm//@types" ,
20
+ "@npm//rxjs" ,
17
21
],
18
22
)
19
23
20
- load ("@build_bazel_rules_typescript//:defs.bzl" , "ts_devserver" )
24
+ filegroup (
25
+ name = "rxjs_umd_modules" ,
26
+ srcs = [
27
+ # do not sort
28
+ "@npm//node_modules/rxjs:bundles/rxjs.umd.js" ,
29
+ ":rxjs_shims.js" ,
30
+ ],
31
+ )
21
32
22
33
ts_devserver (
23
34
name = "devserver" ,
24
- additional_root_paths = [
25
- "npm/node_modules/tslib" ,
26
- "npm/node_modules/zone.js/dist" ,
27
- ],
28
35
entry_module = "bazel_integration_test/src/main" ,
36
+ index_html = "index.html" ,
29
37
scripts = [
30
38
"@npm//node_modules/@angular/common:bundles/common.umd.js" ,
31
39
"@npm//node_modules/@angular/common:bundles/common-http.umd.js" ,
32
40
"@npm//node_modules/@angular/core:bundles/core.umd.js" ,
33
41
"@npm//node_modules/@angular/platform-browser:bundles/platform-browser.umd.js" ,
42
+ "@npm//node_modules/tslib:tslib.js" ,
43
+ ":rxjs_umd_modules" ,
34
44
],
35
45
serving_path = "/bundle.min.js" ,
36
46
static_files = [
37
- "@npm//node_modules/tslib:tslib.js" ,
38
47
"@npm//node_modules/zone.js:dist/zone.min.js" ,
39
- "index.html" ,
40
48
],
41
49
deps = [
42
50
"//src" ,
@@ -46,8 +54,6 @@ ts_devserver(
46
54
],
47
55
)
48
56
49
- load ("@build_bazel_rules_nodejs//:defs.bzl" , "nodejs_binary" , "rollup_bundle" )
50
-
51
57
rollup_bundle (
52
58
name = "bundle" ,
53
59
entry_point = "src/main" ,
@@ -56,25 +62,25 @@ rollup_bundle(
56
62
"@npm//@angular/common" ,
57
63
"@npm//@angular/core" ,
58
64
"@npm//@angular/platform-browser" ,
65
+ "@npm//rxjs" ,
59
66
],
60
67
)
61
68
62
- # Needed because the prodserver only loads static files that appear under this
63
- # package.
64
- genrule (
65
- name = "zone.js" ,
66
- srcs = ["@npm//node_modules/zone.js:dist/zone.min.js" ],
67
- outs = ["zone.min.js" ],
68
- cmd = "cp $< $@" ,
69
+ web_package (
70
+ name = "prodapp" ,
71
+ assets = [
72
+ # do not sort
73
+ "@npm//node_modules/zone.js:dist/zone.min.js" ,
74
+ ":bundle.min.js" ,
75
+ ],
76
+ data = [
77
+ ":bundle" ,
78
+ ],
79
+ index_html = "index.html" ,
69
80
)
70
81
71
- load ("@build_bazel_rules_nodejs//:defs.bzl" , "http_server" )
72
-
73
82
http_server (
74
83
name = "prodserver" ,
75
- data = [
76
- "index.html" ,
77
- ":bundle" ,
78
- ":zone.js" ,
79
- ],
84
+ data = [":prodapp" ],
85
+ templated_args = ["src/prodapp" ],
80
86
)
0 commit comments