Angular 2 dependency Zone.js
<p>I am working on a big project that consists of a bunch of modules. I implemented my module using <strong>Angular 2 rc.3</strong>. I am also using webpack to bundle the module. The output of webpack is 3 files: app.js, polyfills.js and vendor.js.
app.js contains application code, vendors.js contains imported angular 2's modules and rxjs operators and polyfills.js contains reflect-metadata and <strong>zone.js</strong> libraries.
polyfills.js is compiled from polyfill.ts that contains:</p>

<pre><code>import 'reflect-metadata';
require('zone.js/dist/zone');
</code></pre>

<p>My module is then used as a part of a big single page application.
My huge concern is the <strong>zone.js dependency</strong>. It patches functions in the global scope. Including this library in my module affects other teams' modules. And this is not acceptable.
There was an issue with the zone.js while transforming a jquery jqXHR to a ES2016 Promise. A jqXHR object is thenable that resolves to itself when rejected. Because of this the resolvePromise function of the zone.js goes into a infinite loop trying to resolve that thenable. And that leads to the browser hanging. I resolved that issue but the main problem is that this issue was not even in my module, but in module of other team.</p>

<p>So you see how adding zone.js to my module can lead to errors in other modules. And I can not allow that.</p>

<p><strong>My question is how can I sandbox zone.js only for my module</strong> so it could not affect other modules? It is a peaty if Angular team didn't think of it because I belive it will be a blocker not only for me but for other developers and companies too.</p>