Skip to content

Commit 99ea5d7

Browse files
JiaLiPassionAndrewKushnir
authored andcommitted
fix(zone.js): fix zone-patch-rxjs bundle to refer to rxjs (rather than include) it. (#35983)
Close #35878. Before zone.js 0.10, the rollup config would refer to `rxjs` when bundling `zone-patch-rxjs.js` From zone.js 0.10, we started to use bazel to build `zone-patch-rxjs.js` and the configuration was wrongly defined to include a copy of `rxjs` in the `zone-patch-rxjs.js`. PR Close #35983
1 parent 8ea61a1 commit 99ea5d7

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

packages/zone.js/rollup-es5.config.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ module.exports = {
2727
}),
2828
commonjs(),
2929
],
30-
external: ['electron'],
31-
output: {globals: {electron: 'electron'}, banner},
30+
external: id => {
31+
if (/build-esm/.test(id)) {
32+
return false;
33+
}
34+
return /rxjs/.test(id) || /electron/.test(id);
35+
},
36+
output: {
37+
globals: {
38+
electron: 'electron',
39+
'rxjs/Observable': 'Rx',
40+
'rxjs/Subscriber': 'Rx',
41+
'rxjs/Subscription': 'Rx',
42+
'rxjs/Scheduler': 'Rx.Scheduler',
43+
'rxjs/scheduler/asap': 'Rx.Scheduler',
44+
'rxjs/scheduler/async': 'Rx.Scheduler',
45+
'rxjs/symbol/rxSubscriber': 'Rx.Symbol'
46+
},
47+
banner
48+
},
3249
}

packages/zone.js/test/npm_package/npm_package.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ describe('Zone.js npm_package', () => {
5353
() => { expect(shx.cat('zone_externs.js')).toContain('Externs for zone.js'); });
5454
});
5555

56+
describe('rxjs patch', () => {
57+
it('should not contain rxjs source', () => {
58+
expect(shx.cat('zone-patch-rxjs.js'))
59+
.not.toContain('_enable_super_gross_mode_that_will_cause_bad_things');
60+
});
61+
});
62+
5663
describe('es5', () => {
5764
it('zone.js(es5) should not contain es6 spread code',
5865
() => { expect(shx.cat('zone.js')).not.toContain('let value of values'); });

0 commit comments

Comments
 (0)