From 00497437a6773ddab2c2a7c66a626eee48aad2d5 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Wed, 28 Mar 2018 09:19:00 -0700 Subject: [PATCH] fix(bazel): don't inline tslib into fesms (#23044) PR Close #23044 --- packages/bazel/test/ng_package/core_package.spec.ts | 5 +++++ tools/defaults.bzl | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/bazel/test/ng_package/core_package.spec.ts b/packages/bazel/test/ng_package/core_package.spec.ts index 9cb16477a6..d38102a466 100644 --- a/packages/bazel/test/ng_package/core_package.spec.ts +++ b/packages/bazel/test/ng_package/core_package.spec.ts @@ -122,6 +122,11 @@ describe('@angular/core ng_package', () => { it('should not be processed by tsickle', () => { expect(shx.cat('fesm5/core.js')).not.toContain('@fileoverview added by tsickle'); }); + + it('should load tslib from external bundle', () => { + expect(shx.cat('fesm5/core.js')).not.toContain('function __extends'); + expect(shx.cat('fesm5/core.js')).toMatch('import {.*__extends'); + }); }); diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 5976bb9322..da86fa87e4 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -45,7 +45,7 @@ def ng_module(name, tsconfig = None, entry_point = None, **kwargs): entry_point = "public_api.ts" _ng_module(name = name, flat_module_out_file = name, tsconfig = tsconfig, entry_point = entry_point, **kwargs) -def ng_package(name, readme_md = None, license_banner = None, **kwargs): +def ng_package(name, readme_md = None, license_banner = None, globals = {}, **kwargs): if not readme_md: readme_md = "//packages:README.md" if not license_banner: @@ -55,6 +55,9 @@ def ng_package(name, readme_md = None, license_banner = None, **kwargs): name = name, readme_md = readme_md, license_banner = license_banner, + globals = dict(globals, **{ + "tslib": "tslib" + }), replacements = PKG_GROUP_REPLACEMENTS, **kwargs)