72

I am building a Angular4 project using Angular CLI (1.1.2). It runs perfectly in Chrome (Version 59.0.3071.115) and firefox(54.0.1) but when I tried to use IE11 (Verison 11.0.9600.18738) nothings shows up and when I open the develper mode in IE, it shows me the following Error:

SCRIPT5022: Exception thrown and not caught
File: polyfills.bundle.js, Line: 829, Column: 34

And the detailed Error message is following:

enter image description here

Anyone knows how to solve this problem?

Thanks!

2
  • 3
    src/polyfills.ts
    – Z. Bagley
    Commented Jul 27, 2017 at 14:28
  • 3
    Thanks! I just figured out I need to uncomment lines of the codes in polyfills.ts Commented Jul 27, 2017 at 14:56

3 Answers 3

82

To add more detail to @Zeqing's answer.

I uncommented the following line of codes in .\my-app\src\polyfills.ts :

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
4
  • Worked for me when i added a Angular CLI template app in VS 2017
    – Steve
    Commented Oct 26, 2017 at 22:41
  • 4
    You're probably importing more than you need and bloating your bundle size. As of March 2018, a new cli project will run fine on IE11 with all these commented out except es6/string and es6/array.
    – adamdport
    Commented Mar 6, 2018 at 15:09
  • 1
    The file is .\my-app\src\polyfills.ts Commented Jul 18, 2018 at 4:59
  • 1
    Super helpful. Thank you :)
    – gnzg
    Commented Feb 5, 2020 at 15:55
69

The default polyfills.ts file is commented and need to uncomment lines of code and run npm install the corresponding module. Then it will compatible with the IE11

2
  • 2
    Sorry, what the modules should be installed to make it compatibe with IE11? Commented Jun 3, 2018 at 14:56
  • 2
    @dmitry_bond whichever ones you need. If you use [1,2,3].includes(3) for example, .includes would blow up in IE11 until you uncommented core-js/es6/array. If you don't use any es6 features, you don't need to include any of them and your app will still be compatible with IE11.
    – adamdport
    Commented Jul 27, 2018 at 13:54
10

I got this when I tried to add an es7 import. I simply replaced the es6 import with the es7 import. Turns out I needed both.

Gives me "Exception thrown and not caught" error:

import 'core-js/es7/array';

Works fine:

import 'core-js/es6/array';
import 'core-js/es7/array';

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.