-
Notifications
You must be signed in to change notification settings - Fork 12k
NG 8 IE 11 & Differential Loading #16653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@destus90 Thank you for your reply. 2- Yes I uploaded the same image twice 😁 (fixed) 1- I see from your link on the angular site it does mention: "Some legacy browsers still download both bundles, but only execute the appropriate scripts based on the attributes mentioned above." That's a little disappointing, we just moved to Angular 8 and differential loading seemed to be one of the killer features, reading @StephenFluin blog post I was excited. The thing is that most of our users are running modern browsers, it's just IE11 that's the issue for corporate clients and I feel like this is where differential loading would shine. However it looks like for our clients this is the reality: Could we not also just wrap the ES2015 bundle in something like:
I feel like this is a solvable problem for the whole Angular community, I also feel like IE11 should be the focus of differential loading as most of the other browsers are evergreen and can all use the 2015 feature set. 3 - Still the biggest issue for me is that the es5 bundle (non differential loading works) but the es5 bundle (when differential loading is turned on) does not work. But they should be the same es5 bundle, it's just that we have a second bundle for modern browsers, right? The most upvoted "How do I make Angular 8 compatible with IE11?" answer on stack overflow is to disable differential loading, but it should work with IE11 and differential loading, so I feel like others have this issue maybe I am just the first one to raise it. |
linked the wrong issue id in prev edit... |
Can you try to update With regards to the conditional html comments ie: |
Tried the attached demo project with Downgrading to ... This still leaves the bigger issue of both packages being downloaded on IE 11
|
Maybe we could use something like: https://stackoverflow.com/questions/29987969/how-to-load-a-script-only-in-ie
to prevent downloading both bundles in IE11. |
The current method used for execution bifurcation was chosen after research into a variety of methods. There are indeed tradeoffs for some older browsers (IE in particular). However, as best explained in this comment from one of the Chrome team members, the real world affect of the double download is generally minimal to non-existent. This is in contrast to the effect of the method in the above comment (as well as others), which can have large performance issues for modern browsers especially on mobile platforms. If the user base of a particular application is predominantly using IE, targeting ES5 may be the best option for the application. It is also possible to post process the generated index to alter the differential loading method if testing reveals non-ideal performance metrics for a given application's usage environment. Another option would be using a server generated index per request and opens up potential additional avenues regarding attempts at browser detection guided script selection. |
@clydin thanks for the link. Web development = complexity! Your argument about desktop vs mobile does make sense. For us, currently, I don't think we can choose almost a double initial bundle for IE and other older browsers to get faster performance in modern browsers, as our bundle is embarrassingly large 😁 . Hopefully, this will change in the future. I feel like the marketing for this feature missed the mark a bit. The statement "When users load your application, they’ll automatically get the bundle they need." from Version 8 of Angular — Smaller bundles, CLI APIs, and alignment with the ecosystem is not super accurate. As you pointed out it's really a compromise, and while modern browsers get better smaller bundles and parse performance older browsers initial bundle size is almost doubled, I know the docs do make a cursory reference to this but it might be worthwhile to make this tradeoff more prominent, for anyone else with embarrassingly large bundles, as I thought I could just drop this in and win! I don't think we will be using this feature for the next couple of months until our initial bundle is not embarrassingly large (working on it), but we should still work to fix issues 2 and 3 for others 😃 . Thanks again. |
well, tried 0.803.19 and .25 It throws error like Object doesn't support property or method 'includes' |
@maxisam In my case, i had to add the following imports (using core-js 3). You need to find out which ones you need. import 'core-js/features/array/includes';
import 'core-js/features/array/values';
import 'core-js/features/array/entries';
import 'core-js/features/object/values';
import 'core-js/features/object/entries'; |
Thanks! I just noticed that as well. And I also noticed that if we import extra code like import 'core-js/features/array/includes'; It shows up in both es2015 and es5 polyfills. I think Angular should put what polyfills it includes in the document somewhere. Here is the es5 polyfills used in Angular |
@maxisam , |
I have the same problem with loading ESRI maps on es5 working ok but on es2015 I get TypeError |
I'm reporting here that this is an issue that impacted the functionality of our app. IE11 was loading both bundles, and a login button would not become enabled (no idea why that button was impacted, but it was an immediate and obvious error). I'm serving via Express, so upon server start I have express create a version of index.html without es2015 references, and then with the (mostly reliable) express-useragent npm module I serve that up as index to IE11. Problem went away. NOTE: this was ng9. For ng8 we were doing es5 builds, and I wanted to stop that. |
Regarding the three points raised in the original post:
I'm not able to confirm (3) as I don't have IE on-hand atm. If that is accurate, then it seems like this is all WAI, just some confusion around the /cc @aikidave as FYI for future improvements to docs (points (2) and (3) in particular don't seem to be covered anywhere). |
@dpg1130 Something I don't want to see lost, though, is that, with the default ng9 configs, IE11 was failing to run the application correctly when the es2015 bundles were being downloaded. Even though it was also downloading the es5 bundles. This isn't just a performance hit I don't want to take, but there's something going on that's more hinky than IE11 just ignoring the es2015 contents (and suppressing those files for IE11 fixed the issue). |
@rplotkin Can you provide the content of the index.html file that was failing (that contained both bundle sets), or even better, a reproduction? It might also be easier to investigate if a separate issue was opened (please include full version information as well). A browser will not execute a script if the |
Can you share how did you do it? I have similar approach - need to support IE11, but care only about es2015 bundle size. |
Sure. First I wrote a
Then I generate my js file like this:
Then I get the js file somewhere with a hash, say,
The hash is useful for versionning and caching. |
@michaelz thx for quick response! I thought that this can be incorporated into angular build process, but having it prepared before is also doable. I am happy as long as it work as intended. |
@ckrasi-acx I didn't do it because this file doesn't change that much, and it takes a really long time to compile for some reason... but it's doable ! Our jenkins pipeline already a lot of time and I didn't want to add a couple of minutes to it. |
This issue is now obsolete since differential loading will be removed in the next major version. See: #21467 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
The issue is caused by package @angular/ ... not sure cli? it's a build issue
Description
So there are a few things to track here:
Specifically in IE11
If I build the linked project with the
tsconfig.json
target "es5" everything works. (baseline).If I build the project with
tsconfig.json
target "es2015" a few things do not work as I expect:Differential loading

No differential loading

From the above images you can see that the main bundle for the base ES5 scenario is 282 but for the differential loading its 298. Again this is a small sample app, in our production app this is more pronounced.
🔬 Minimal Reproduction
https://github.com/vespertilian/ng8-ie11
build with npm run build
serve the dist build with ng run serve-dist (might need to install http-server)
change ts.config from es5 to es2015 to build the different packages.
🔥 Exception or Error
Just for the third case
🌍 Your Environment
Angular Version:
Anything else relevant?
The text was updated successfully, but these errors were encountered: