Skip to content

Commit

Permalink
build: embed tslib in umd bundles (#1760)
Browse files Browse the repository at this point in the history
When tslib is listed as part of the globals, it will not be embedded in the UMD bundles.
https://github.com/angular/angular/blob/fd65958b887f6ea8dd5235e6de1d533e4c578602/packages/bazel/src/ng_package/ng_package.bzl#L226-L228

Users using UMD bundles, shouldn't be needing to add the tslib script, also this is important because tslib is a direct depedency of the package and not a peer depedency.

This is also to align with the Angular FW packages.
  • Loading branch information
alan-agius4 committed Jul 8, 2020
1 parent 9e0a150 commit eadf4d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ GLOBALS = {
"@hapi/hapi": "hapi.hapi",
"rxjs": "rxjs",
"rxjs/operators": "rxjs.operators",
"tslib": "tslib",
}

def ng_module(name, tsconfig = None, testonly = False, deps = [], bundle_dts = True, **kwargs):
Expand Down Expand Up @@ -127,10 +126,12 @@ def ng_test_library(deps = [], tsconfig = None, **kwargs):
**kwargs
)

def ng_package(globals = {}, **kwargs):
def ng_package(globals = {}, deps = [], **kwargs):
globals = dict(globals, **GLOBALS)

_ng_package(globals = globals, substitutions = PKG_GROUP_REPLACEMENTS, **kwargs)
deps = deps + [
"@npm//tslib",
]
_ng_package(globals = globals, deps = deps, substitutions = PKG_GROUP_REPLACEMENTS, **kwargs)

def pkg_npm(name, substitutions = {}, **kwargs):
_pkg_npm(
Expand Down

0 comments on commit eadf4d4

Please sign in to comment.