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
This commit is contained in:
JiaLiPassion 2020-03-10 13:44:13 +09:00 committed by Andrew Kushnir
parent 8ea61a19cd
commit 99ea5d7044
2 changed files with 26 additions and 2 deletions

View File

@ -27,6 +27,23 @@ module.exports = {
}), }),
commonjs(), commonjs(),
], ],
external: ['electron'], external: id => {
output: {globals: {electron: 'electron'}, banner}, if (/build-esm/.test(id)) {
return false;
}
return /rxjs/.test(id) || /electron/.test(id);
},
output: {
globals: {
electron: 'electron',
'rxjs/Observable': 'Rx',
'rxjs/Subscriber': 'Rx',
'rxjs/Subscription': 'Rx',
'rxjs/Scheduler': 'Rx.Scheduler',
'rxjs/scheduler/asap': 'Rx.Scheduler',
'rxjs/scheduler/async': 'Rx.Scheduler',
'rxjs/symbol/rxSubscriber': 'Rx.Symbol'
},
banner
},
} }

View File

@ -53,6 +53,13 @@ describe('Zone.js npm_package', () => {
() => { expect(shx.cat('zone_externs.js')).toContain('Externs for zone.js'); }); () => { expect(shx.cat('zone_externs.js')).toContain('Externs for zone.js'); });
}); });
describe('rxjs patch', () => {
it('should not contain rxjs source', () => {
expect(shx.cat('zone-patch-rxjs.js'))
.not.toContain('_enable_super_gross_mode_that_will_cause_bad_things');
});
});
describe('es5', () => { describe('es5', () => {
it('zone.js(es5) should not contain es6 spread code', it('zone.js(es5) should not contain es6 spread code',
() => { expect(shx.cat('zone.js')).not.toContain('let value of values'); }); () => { expect(shx.cat('zone.js')).not.toContain('let value of values'); });