fix(bazel): pass --global option to rollup (#23073)

This fixes the UMD bundles which otherwise don't contain the right global symbols

PR Close #23073
This commit is contained in:
Alex Eagle 2018-03-29 16:24:59 -07:00 committed by Igor Minar
parent 0d9140cdce
commit 45e090b614
3 changed files with 63 additions and 20 deletions

View File

@ -50,9 +50,13 @@ def _rollup(ctx, rollup_config, entry_point, inputs, js_output, format = "es"):
args.add("--sourcemap") args.add("--sourcemap")
globals = dict(WELL_KNOWN_GLOBALS, **ctx.attr.globals) globals = dict(WELL_KNOWN_GLOBALS, **ctx.attr.globals)
externals = globals.keys()
args.add("--external") args.add("--external")
args.add(externals, join_with=",") args.add(globals.keys(), join_with=",")
args.add("--globals")
args.add(["%s:%s" % g for g in globals.items()], join_with=",")
args.add("--silent")
other_inputs = [ctx.executable._rollup, rollup_config] other_inputs = [ctx.executable._rollup, rollup_config]
if ctx.file.license_banner: if ctx.file.license_banner:

View File

@ -34,6 +34,9 @@ describe('@angular/common ng_package', () => {
]); ]);
}); });
it('should reference core using global symbol in umd',
() => { expect(shx.cat('bundles/common.umd.js')).toContain('global.ng.core'); });
it('should have right fesm files', () => { it('should have right fesm files', () => {
const expected = [ const expected = [
'common.js', 'common.js',

File diff suppressed because one or more lines are too long