How do I make Angular 8 compatible with IE11?

adamdport picture adamdport · Jun 12, 2019 · Viewed 15.3k times · Source

I upgraded to Angular 8 using ng update. It ran its migration scripts which (among other things) removed the es6/es7 imports in polyfills.ts. From what I read, Angular will create a special build for older browsers (including IE11) and I don't have to worry about polyfills anymore? I updated browserlist to be not IE 9-10 instead of not IE 9-11 to (I presume) hint that it should build the appropriate polyfills.

Unfortunately, after running ng build, I get some polyfill related errors, eg. Reflect.getMetadata is not a function and Object doesn't support property or method 'includes'. I tried putting reflect and array imports back into polyfills and move past those errors, but I get others. What's the deal? Am I supposed to include polyfills or not?

How do I make Angular 8 work with IE11?

Answer

Christopher Taleck picture Christopher Taleck · Jun 20, 2019

One way to get IE 11 to work with Angular 8 is to disable differential loading.

Do the following:

  1. Update tsconfig.json with "target": "es5"
  2. Update polyfills.ts with import 'core-js'; // core-js@^3.1.4