2
2
3
3
load ("@rules_pkg//:pkg.bzl" , "pkg_tar" )
4
4
load ("@rules_sass//src:index.bzl" , _sass_binary = "sass_binary" , _sass_library = "sass_library" )
5
- load ("@npm//@angular/bazel :index.bzl" , _ng_package = "ng_package" )
5
+ load ("@rules_angular//src/ng_package :index.bzl" , _ng_package = "ng_package" )
6
6
load ("//:packages.bzl" , "NO_STAMP_NPM_PACKAGE_SUBSTITUTIONS" , "NPM_PACKAGE_SUBSTITUTIONS" )
7
7
load ("//:pkg-externals.bzl" , "PKG_EXTERNALS" )
8
8
load ("//tools/markdown-to-html:index.bzl" , _markdown_to_html = "markdown_to_html" )
@@ -64,21 +64,17 @@ def ng_package(
64
64
externals = externals ,
65
65
srcs = srcs + [":license_copied" ],
66
66
deps = deps ,
67
- # We never set a `package_name` for NPM packages, neither do we enable validation.
68
- # This is necessary because the source targets of the NPM packages all have
69
- # package names set and setting a similar `package_name` on the NPM package would
70
- # result in duplicate linker mappings that will conflict. e.g. consider the following
71
- # scenario: We have a `ts_library` for `@angular/cdk`. We will configure a package
72
- # name for the target so that it can be resolved in NodeJS executions from `node_modules`.
73
- # If we'd also set a `package_name` for the associated `pkg_npm` target, there would be
74
- # two mappings for `@angular/cdk` and the linker will complain. For a better development
75
- # experience, we want the mapping to resolve to the direct outputs of the `ts_library`
76
- # instead of requiring tests and other targets to assemble the NPM package first.
77
- package_name = None ,
78
- validate = False ,
67
+ package = package_name ,
79
68
readme_md = readme_md ,
80
69
substitutions = npmPackageSubstitutions ,
81
70
visibility = visibility ,
71
+ rollup_runtime_deps = [
72
+ "//:node_modules/@rollup/plugin-commonjs" ,
73
+ "//:node_modules/@rollup/plugin-node-resolve" ,
74
+ "//:node_modules/magic-string" ,
75
+ "//:node_modules/rollup-plugin-dts" ,
76
+ "//:node_modules/rollup-plugin-sourcemaps2" ,
77
+ ],
82
78
** kwargs
83
79
)
84
80
@@ -97,6 +93,6 @@ def ng_package(
97
93
name = "pkg" ,
98
94
src = ":%s" % name ,
99
95
visibility = visibility ,
100
- interop_deps = [ d . replace ( "_legacy" , "" ) for d in deps ] + package_deps ,
96
+ interop_deps = deps + package_deps ,
101
97
package_name = package_name ,
102
98
)
0 commit comments