Search code examples
ecmascript-6internet-explorer-11angular9polyfills

Does IE11 support es2015?


I am running angular 9 on IE11. In tsconfig.json

    {
      "compileOnSave": false,
      "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es2015",
        "typeRoots": [
          "node_modules/@types"
        ],
        "lib": [
          "es2017",
          "dom"
        ]
      },
      "angularCompilerOptions": {
        "strictInjectionParameters": true
      }
}

Yes, it will work if I use "target": "es5" instead of "target": "es2015". So my question is can I use "target": "es2015" to run angular 9 on IE11? I am getting an error though. Error: err

I have commented all the core-js/.. imports from polyfills.ts. Because: https://stackoverflow.com/a/56893234/14208324 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/weak-map';
// import 'core-js/es6/set';

import 'classlist.js'; 

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';


/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
// import 'core-js/es7/reflect';


/**
 * Web Animations `@angular/platform-browser/animations`
 * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
 * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
 **/
import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone';  // Included with Angular CLI.

Angular and Anglura-cli version:

Angular CLI: 9.1.12
Node: 10.15.3
OS: win32 x64

Angular: 9.1.12

Note: If I use "target": "es5" as target, no error is being shown but the page remains blank. App is working on chrome and firefox.

Am I missing something?


Solution

  • The Angular app will not work with the IE browser if the target is set as es2015.

    I did not get any way to make the angular app work in the IE browser with the target set as es2015.

    So there is no way to support the angular app by using the target as es2015.

    User needs to set the target as es5 to support the IE browser.