<p dir="auto">There are several issues with non-core (angular2.js) bundles we publish to npm:</p>
<ul dir="auto">
<li>we are not using any bundle arithmetic which means that we bundle parts of the core with those optional bundles. This is mostly visible in http where the bundle is pulling most of ng2 (if not all!) and is in fact bigger than ng2 itself (!)</li>
<li>non-core bundle import non-public APIs (ex.: <code class="notranslate">angular2/src/core/facade/lang</code> in router). This makes it pretty hard impossible (?) to move to CJS bundles that wouldn't have to bundle core again.</li>
</ul>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jeffbcross/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jeffbcross">@jeffbcross</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rkirov/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rkirov">@rkirov</a></p>
<p dir="auto">To start with the current SFX bundle (<code class="notranslate">angular2.sfx.dev</code>):</p>
<ul dir="auto">
<li>contains the following barrels: zone, reflect-metadata, common, core, instrumentation, platform/browser, upgrade, http, router:
<ul dir="auto">
<li>common, core, instrumentation, platform/browser are exported on the <code class="notranslate">ng</code> namespace</li>
<li>http is exported on the <code class="notranslate">ngHttp</code> namespace</li>
<li>router is exported on the <code class="notranslate">ngRouter</code> namespace</li>
</ul>
</li>
<li>is using <code class="notranslate">dev</code> output</li>
<li>isn't minified</li>
<li>doesn't have source maps</li>
<li>provides support for <a href="https://github.com/angular/angular/blob/c6d6b756910b793a58c27bd219a54cf34eea090a/modules/angular2/angular2_sfx.ts#L19-L22">noConflict mode</a> -&gt; although it is broken now since it doesn't restore <code class="notranslate">ngHttp</code> and <code class="notranslate">ngRouter</code> namespaces</li>
</ul>
<p dir="auto">As part of our bundling discussion(s) we've been several times touching upon role, content and setup of the SFX bundle. More specifically the open questions were / are:</p>
<ul dir="auto">
<li>who is the main consumer of the SFX bundle (ES5, ngUpgrade?). AFAIK <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rkirov/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rkirov">@rkirov</a> is aware of another use-case</li>
<li>shell we use the same bundle for ES5 and ngUpgrade scenarios?</li>
<li>what should be the content? Some barrels are non-controversial (common, core, instrumentation, platform/browser) other are disputable</li>
<li>what exact namespaces shell be used to export different barrels?</li>
<li>should we keep the non-conflict mode?</li>
</ul>
<p dir="auto">From the list above we can see that there are number of small decisions that we need to take.</p>