Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular ng serve does not include polyfills -- IE11/Edge only working when running ng build --prod

I've tried using both npm run start and ng serve for this. In all cases, the app produced does NOT work at all in IE11 and Edge.

There are many other problems surrounding IE11 and Edge but this is strictly about the problem with Angular CLI not being able to effectively include the polyfills when running ng serve.

    ng serve

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2018-10-01T15:27:24.006Z
Hash: f7ee38fccff1d585e3ed
Time: 12681ms
chunk {main} main.js, main.js.map (main) 119 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 452 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 86.4 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.2 MB [initial] [rendered]
i 「wdm」: Compiled successfully.

This is absolutely necessary as I need to make my app completely IE11/Edge compatible and I Can't build for production to check if centering a div has worked.

EDIT1:

Running ng serve --prod seems to actually work BUT goodness is it slow when modifying something. Would still like to find a way around this.

like image 339
SebastianG Avatar asked Oct 01 '18 15:10

SebastianG


People also ask

Does Angular 8 support IE11?

Since Angular CLI 8, there is a new feature called Differential Loading. If you updated through the CLI, running ng serve will target ES2015 by default, which IE11 and older browsers do not support.

Does Angular support IE11?

Google has removed IE11 support in Angular 13.

Is Angular 9 compatible with IE11?

I also made a new angular 9 app and it can work well in IE 11. I added a new tsconfig-es5. app. json file, updated angular.


1 Answers

This may be a little late for you, but in case anyone else finds it... I had a similar problem where my Angular 7 application made from scratch with the CLI worked everywhere except with Microsoft's EDGE browser when run from ng serve. (Yes, IE 11 worked, but EDGE didn't. Go figure.)

Anyway, I found this article: https://github.com/angular/angular-cli/issues/8596

A comment from user clydin provided the fix for me (even though they were talking about Safari). They said:

The error is due to the development server's live reload client code (from webpack-dev-server) which requires basic ES2015 support. This will not affect builds (production or otherwise) of the application as the live reload code is not present. Live reload functionality can be disabled, if desired, via the --no-live-reload option. Due to a defect in safari 10, enabling source maps on ng serve (the default) results in a similar error. This does not affect Safari 11.

I created a script in my package.json and when I ran this script, EDGE worked. You might also have luck with this flag.

"app-edge": "ng serve --host 0.0.0.0 --disable-host-check --no-live-reload"
like image 192
Chris Avatar answered Jan 03 '23 13:01

Chris