title: IE11 - Unhandled Promise rejection: Syntax error
body: <p>I am working on an Angular 2 application and for the first time added some <code>async/await</code> features. Everything works fine locally but once its deployed on my test server where I receive this error in <code>IE11</code> (<em>see bottom of question for complete browser stack trace</em>):</p>
  
  <blockquote>
    <p>Unhandled Promise rejection: Syntax error</p>
  </blockquote>
  
  <p><strong>The error occurs when the Angular2 application is being loaded</strong>, not when the method executes. The error points to this method (<em>it also happens to be the only method in this component</em>).</p>
  
  <p><strong>my-component.ts</strong></p>
  
  <pre><code>async logoff(event: { preventDefault: () =&gt; void }) {
      event.preventDefault();
      await this.authService.logoff();
      window.location.href = '/Account/Login';
  }
  </code></pre>
  
  <p>It is the first time I have introduced <code>async/await</code> so I know this is the point of the failure.</p>
  
  <h2>Testing Steps</h2>
  
  <ul>
  <li>I use Visual Studio to publish a release version to my local IIS. Spces are:
  
  <ul>
  <li>Windows 10 (x64)</li>
  <li>IIS</li>
  </ul></li>
  <li><p>I then run install my npm packages I need for production environment in my published directory</p>
  
  <pre><code>npm i --production
  </code></pre></li>
  <li><p>I open the <code>IE11</code> browser and run the application from IIS and <strong>everything works, no errors</strong>.</p></li>
  <li>I then make a complete copy of my published directory and copy it to my test server. Test server spces are:
  
  <ul>
  <li>Windows 2012 R2 Standard</li>
  <li>IIS</li>
  </ul></li>
  <li>I then browser to the site using the same IE11 browser instance on my Dev machine I used previously and receive the error above.</li>
  </ul>
  
  <p><strong>So why does it fail when I run it from my test server and not fail when I run it from my local machine?</strong> Is there a required Node or NPM module/package that needs to be installed globally for shims to work correctly from IE11 or is there a problem with something else? I am at a loss here.</p>
  
  <h2>Configuration</h2>
  
  <p><em>If there is anything I can add to this please let me know, I will update the question.</em></p>
  
  <p><strong>tsconfig.js</strong></p>
  
  <p><em>As per <a href="https://angular.io/docs/ts/latest/guide/typescript-configuration.html" rel="nofollow noreferrer">recommended configuration</a></em></p>
  
  <pre><code>{
    "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "moduleResolution": "node",
      "sourceMap": true,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "lib": [ "es2015", "dom" ],
      "removeComments": false,
      "noImplicitAny": false,
      "suppressImplicitAnyIndexErrors": true
    },
    "compileOnSave": true
  }
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>  "dependencies": {
      "@angular/common": "2.4.8",
      "@angular/compiler": "2.4.8",
      "@angular/core": "2.4.8",
      "@angular/forms": "2.4.8",
      "@angular/http": "2.4.8",
      "@angular/platform-browser": "2.4.8",
      "@angular/platform-browser-dynamic": "2.4.8",
      "@angular/router": "3.4.8",
      "core-js": "~2.4.1",
      "jquery": "~3.1.1",
      "lodash": "^4.17.4",
      "reflect-metadata": "^0.1.9",
      "rxjs": "5.2.0",
      "systemjs": "0.20.9",
      "zone.js": "^0.7.7"
    }
  </code></pre>
  
  <p><strong>Index.html</strong> (<em>scripts only</em>)</p>
  
  <pre><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/shim.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.0.1/Rx.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.7.7/zone.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/reflect-metadata/0.1.8/Reflect.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      System.import('system-config.js')
          .then(function() {
              System.import('main');
          })
          .catch(console.error.bind(console));
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Complete client side stack trace</strong></p>
  
  <pre><code>Unhandled Promise rejection: Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main ; Zone: &lt;root&gt; ; Task: Promise.then ; Value: Error: Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/a
     "Unhandled Promise rejection:"
     "Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main"
     "; Zone:"
     "&lt;root&gt;"
     "; Task:"
     "Promise.then"
     "; Value:"
     {
        [functions]: ,
        __proto__: { },
        __zone_symbol__error: { },
        __zone_symbol__message: "Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main",
        __zone_symbol__number: undefined,
        description: "Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main",
        message: "Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main",
        name: "Error",
        number: undefined,
        originalErr: { },
        originalStack: undefined,
        stack: "SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6096)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6268)
     at Anonymous function (eval code:20:1)
     at Anonymous function (eval code:1:31)
     at eval code (eval code:1:2)
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (",
        Symbol()_n.tcfyoms51l2: undefined,
        Symbol()_o.tcfyoms51l2: undefined,
        Symbol()_p.tcfyoms51l2: undefined,
        Symbol()_q.tcfyoms51l2: undefined,
        Symbol()_r.tcfyoms51l2: undefined,
        Symbol()_s.tcfyoms51l2: undefined,
        Symbol()_t.tcfyoms51l2: undefined,
        Symbol()_u.tcfyoms51l2: undefined,
        Symbol(rxSubscriber)_m.tcfyoms51l2: undefined,
        zoneAwareStack: undefined
     }
     "SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6096)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6268)
     at Anonymous function (eval code:20:1)
     at Anonymous function (eval code:1:31)
     at eval code (eval code:1:2)
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x ("
  
  Error: Uncaught (in promise): Error: Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main
  SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6096)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6268)
     at Anonymous function (eval code:20:1)
     at Anonymous function (eval code:1:31)
     at eval code (eval code:1:2)
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/sys
     {
        [functions]: ,
        __proto__: { },
        __zone_symbol__error: { },
        __zone_symbol__number: undefined,
        description: "Uncaught (in promise): Error: Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main
  SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6096)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6268)
     at Anonymous function (eval code:20:1)
     at Anonymous function (eval code:1:31)
     at eval code (eval code:1:2)
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0",
        message: "Uncaught (in promise): Error: Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main
  SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6096)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6268)
     at Anonymous function (eval code:20:1)
     at Anonymous function (eval code:1:31)
     at eval code (eval code:1:2)
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0",
        name: "Error",
        number: undefined,
        originalStack: undefined,
        promise: { },
        rejection: { },
        stack: "Error: Uncaught (in promise): Error: Syntax error
    Evaluating http://mytest.server.domain/Scripts/my-component.js
    Evaluating http://mytest.server.domain/Scripts/app.module.js
    Evaluating http://mytest.server.domain/Scripts/main.js
    Loading main
  SyntaxError: Syntax error
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:25003)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:5:224)
     at j (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7593)
     at S (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:7059)
     at x (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6096)
     at Anonymous function (https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.20.9/system.js:4:6268)
     at Anonymous function (eval code:20:1)
     at Anonymous function (eval code:1:31)
     at eval code (eval code:1:2)
     at Pe (https://cdnjs.cloudflare.com/ajax/libs/sys",
        Symbol()_n.tcfyoms51l2: undefined,
        Symbol()_o.tcfyoms51l2: undefined,
        Symbol()_p.tcfyoms51l2: undefined,
        Symbol()_q.tcfyoms51l2: undefined,
        Symbol()_r.tcfyoms51l2: undefined,
        Symbol()_s.tcfyoms51l2: undefined,
        Symbol()_t.tcfyoms51l2: undefined,
        Symbol()_u.tcfyoms51l2: undefined,
        Symbol(rxSubscriber)_m.tcfyoms51l2: undefined,
        task: { },
        zone: { },
        zoneAwareStack: undefined
     }
  </code></pre>