Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/bazel/src/ng_package/ng_package.bzl
Expand Up @@ -50,9 +50,13 @@ def _rollup(ctx, rollup_config, entry_point, inputs, js_output, format = "es"):
args.add("--sourcemap")

globals = dict(WELL_KNOWN_GLOBALS, **ctx.attr.globals)
externals = globals.keys()
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]
if ctx.file.license_banner:
Expand Down
3 changes: 3 additions & 0 deletions packages/bazel/test/ng_package/common_package.spec.ts
Expand Up @@ -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', () => {
const expected = [
'common.js',
Expand Down