How do I support Internet Explorer in an Angular 8 application?
Go to "tsconfig.json" and use target: "es5" instead of "target": "es2015",
target which is inside compileOnSave\compilerOptions
------Simple and Easy Way
You need to change 2 files, polyfills.ts
and tsconfig.json
respectively.
Just add Browser Polyfills in polyfills.ts
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/promise';
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';
and in tsconfig.json
change "target" to es5 like this
"target": "es5",
instead of
"target": "es2015",
According to this issue reply
You need to follow the following steps
- Create a new tsconfig
tsconfig.es5.json
next to tsconfig.json with the below contents
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es5"
}
}
- In
angular.json
Underprojects:yourAppName:architect:build:configurations
, add
"es5": {
"tsConfig": "./tsconfig.es5.json"
}
and projects:yourAppName:architect:serve:configurations
add
"es5": {
"browserTarget": "yourAppName:build:es5"
}
Remember to change yourAppName in app:build:es5 to yourAppName!
full path shown below
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
},
"configurations": {
"production": {
...
},
"es5": {
"tsConfig": "./tsconfig.es5.json"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
...
},
"configurations": {
"production": {
...
},
"es5": {
"browserTarget": "yourAppName:build:es5"
}
}
},
- Run the serve with this configuration using the below command.
ng serve --configuration es5