Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

How to let Angular 8 app work in Internet Explorer 11?

$
0
0

By default in angular version 8, differential loading forng build is enabled.However forng test andng serve, it only generates a single ES2015 build which cannot run in IE11.

 

There're two ways to have ES5 code during serve which make angular 8 app work in IE11.

  1. Disable differential loading completely. (Not recommended)

        You can turn differential loading off by changing thetarget fromes2015 toes5 in yourtsconfig.json.

  2.  Have multiple configurations for serve.

        Step 1: Create a new tsconfigtsconfig-es5.app.json next totsconfig.app.jsonwith the below contents:

{  

 "extends":"./tsconfig.app.json",

 "compilerOptions": {     

    "target":"es5" 

  }

}

      

     Step 2: In yourangular.json add two new configuration section under thebuild andserve 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": "app:build:es5"
    }
  }
},

     Step 3: You can then run the serve with this configuration using the below command.

ng serve --configuration es5




Viewing all articles
Browse latest Browse all 3527

Trending Articles