diff --git a/packages/zone.js/rollup-es5.config.js b/packages/zone.js/rollup-es5.config.js index 049523e5b0..b840d3f528 100644 --- a/packages/zone.js/rollup-es5.config.js +++ b/packages/zone.js/rollup-es5.config.js @@ -27,6 +27,23 @@ module.exports = { }), commonjs(), ], - external: ['electron'], - output: {globals: {electron: 'electron'}, banner}, + external: id => { + 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 + }, } diff --git a/packages/zone.js/test/npm_package/npm_package.spec.ts b/packages/zone.js/test/npm_package/npm_package.spec.ts index c42c5b3377..3fa788670e 100644 --- a/packages/zone.js/test/npm_package/npm_package.spec.ts +++ b/packages/zone.js/test/npm_package/npm_package.spec.ts @@ -53,6 +53,13 @@ describe('Zone.js npm_package', () => { () => { 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', () => { it('zone.js(es5) should not contain es6 spread code', () => { expect(shx.cat('zone.js')).not.toContain('let value of values'); });