When I run my app in IE browser I get this error:
My app works fine in Chrome and Firefox.
When I run my app in IE browser I get this error:
My app works fine in Chrome and Firefox.
Please refer to my reply in this thread:
By default in angular version 8, differential loading for ng build
is enabled. However for ng test
and ng serve
, it only generates a single ES2015 build which cannot run in IE11.
You could refer to the following steps to configure ES5 with angular 8 application, which will make the application work in IE11.
Create a new tsconfig tsconfig-es5.app.json next to tsconfig.app.json with the below contents:
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"target": "es5"
}
}
In your angular.json add two new configuration section (es5 node) under the build and serve target to provide a new tsconfig.
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
},
"configurations": {
"production": {
...
},
"es5": {
"tsConfig": "./tsconfig-es5.app.json"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
...
},
"configurations": {
"production": {
...
},
"es5": {
"browserTarget": "<your application name>:build:es5"
}
}
},
You can then run the serve with this configuration using the below command:
ng serve --configuration es5
Besides, the browserslist file content as below:
> 0.5%
last 2 versions
Firefox ESR
not dead
IE 9-11 # For IE 9-11 support, remove 'not'.
You can then run the serve with this configuration using the below command:
ng serve --configuration es5