<p dir="auto">I've been trying to get a simple Angular 2 (beta 1) app running with a minified build (using webpack) - with no success. The cause seems to be the mangle option in the UglifyJSPlugin (with mangle: false it works fine but is 260k heavier).</p>
<p dir="auto">To reproduce the issue, I have created a minimal version (clone, npm install and then webpack -p to reproduce) <a href="https://github.com/frederik/angular2-webpack-uglify">here</a> and also included the logs and a sample of the uglyfied source.</p>
<p dir="auto">I couldn't really see which variables are effected here since errors came up in multiple apps. When I remove ngModel from the view everything goes back to normal. The issues seem to be centered around change detection.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="EXCEPTION: No value accessor for '' in [data.search in e@0:19]
EXCEPTION: No value accessor for '' in [data.search in e@0:19]
ORIGINAL EXCEPTION: No value accessor for ''
ORIGINAL STACKTRACE:
Error: No value accessor for ''
    at new t (http://127.0.0.1:56187/bundle.js:1:12197)
    at s (http://127.0.0.1:56187/bundle.js:1:26713)
    at Object.i [as setUpControl] (http://127.0.0.1:56187/bundle.js:1:25991)
    at t.ngOnChanges (http://127.0.0.1:56187/bundle.js:5:29716)
    at e.ChangeDetector_e_0.detectChangesInRecordsInternal (viewFactory_e:53:59)
    at e.detectChangesInRecords (http://127.0.0.1:56187/bundle.js:7:10658)
    at e.runDetectChanges (http://127.0.0.1:56187/bundle.js:7:10219)
    at e._detectChangesInViewChildren (http://127.0.0.1:56187/bundle.js:7:12475)
    at e.runDetectChanges (http://127.0.0.1:56187/bundle.js:7:10329)
    at e.detectChanges (http://127.0.0.1:56187/bundle.js:7:9902)
ERROR CONTEXT:
e
Live reload enabled."><pre class="notranslate"><code class="notranslate">EXCEPTION: No value accessor for '' in [data.search in e@0:19]
EXCEPTION: No value accessor for '' in [data.search in e@0:19]
ORIGINAL EXCEPTION: No value accessor for ''
ORIGINAL STACKTRACE:
Error: No value accessor for ''
    at new t (http://127.0.0.1:56187/bundle.js:1:12197)
    at s (http://127.0.0.1:56187/bundle.js:1:26713)
    at Object.i [as setUpControl] (http://127.0.0.1:56187/bundle.js:1:25991)
    at t.ngOnChanges (http://127.0.0.1:56187/bundle.js:5:29716)
    at e.ChangeDetector_e_0.detectChangesInRecordsInternal (viewFactory_e:53:59)
    at e.detectChangesInRecords (http://127.0.0.1:56187/bundle.js:7:10658)
    at e.runDetectChanges (http://127.0.0.1:56187/bundle.js:7:10219)
    at e._detectChangesInViewChildren (http://127.0.0.1:56187/bundle.js:7:12475)
    at e.runDetectChanges (http://127.0.0.1:56187/bundle.js:7:10329)
    at e.detectChanges (http://127.0.0.1:56187/bundle.js:7:9902)
ERROR CONTEXT:
e
Live reload enabled.
</code></pre></div>
<p dir="auto">When using minified bundles with SystemJS, and a simple snippet like this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        &lt;template ngFor #item [ngForOf]=&quot;items&quot; #i=&quot;index&quot;&gt;
          &lt;li&gt;{{i}}&lt;/li&gt;
          &lt;li *ngIf=&quot;i % 2 == 0&quot;&gt;number is even&lt;/li&gt;
        &lt;/template&gt;"><pre class="notranslate"><code class="notranslate">        &lt;template ngFor #item [ngForOf]="items" #i="index"&gt;
          &lt;li&gt;{{i}}&lt;/li&gt;
          &lt;li *ngIf="i % 2 == 0"&gt;number is even&lt;/li&gt;
        &lt;/template&gt;
</code></pre></div>
<p dir="auto">Will throw</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: this.directive_0_0.ngDoCheck is not a function"><pre class="notranslate"><code class="notranslate">TypeError: this.directive_0_0.ngDoCheck is not a function
</code></pre></div>
<p dir="auto">This is only reproducible with minified bundles, non-minified work correctly.</p>
<p dir="auto">As an example check this <a href="http://plnkr.co/edit/ZWiQqw3nR8xS1MRrpTry?p=preview" rel="nofollow">plnkr</a> (took it from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="125250401" data-permission-text="Title is private" data-url="https://github.com/angular/angular/issues/6304" data-hovercard-type="issue" data-hovercard-url="/angular/angular/issues/6304/hovercard?comment_id=170200989&amp;comment_type=issue_comment" href="https://github.com/angular/angular/issues/6304#issuecomment-170200989">#6304 (comment)</a>). To reproduce switch between minified and unminified bundles.</p>
<p dir="auto">This is also reproducible with Webpack using this line in the config</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    plugins : [
        new webpack.optimize.UglifyJsPlugin()
    ],"><pre class="notranslate"><code class="notranslate">    plugins : [
        new webpack.optimize.UglifyJsPlugin()
    ],
</code></pre></div>
<p dir="auto">Am I missing something?</p>