iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.11k stars 300 forks source link

IE11 : Promise Polyfill doesn't seem to apply #510

Closed gcebelieu closed 7 years ago

gcebelieu commented 7 years ago

When trying to load itowns examples (for instance : http://www.itowns-project.org/itowns/examples/globe.html ) with ie11 browser? I've the following result :

globe-ie11

with that error in the console :

promise-undef

As itowns bundle contains es6-promise polyfill (as a result of #100 ), it seems that it isn't enough to make iTowns work on ie11 browser.

Your Environment

OS : Windows 7 Professionnel - SP1 (via Oracle VM VirtualBox) Browser : IE11 (version : 11.0.9600.18792)

Context

Integration of iTowns in geoportal web site (live template here : clic on bottom right 2D|3D button to switch to itowns mode), where ie11 compatibility would be greatly appreciated (IE11 comes in third position among browsers used to acces our web site).

Steps to Reproduce (for bugs)

  1. With IE11 browser, open this sample URL : http://www.itowns-project.org/itowns/examples/globe.html
  2. See the result :'(

Expected Behavior

itowns-ff

(Obtained with Firefox. I hope it to be the same with IE11)

Actual Behavior

globe-ie11

And following error in console :

SCRIPT5009: « Promise » est indéfini
Fichier : itowns.js, ligne : 12, colonne : 12627

Possible Cause/Fix/Solution

I'm not very aware of es6-promise and webpack use in itowns. I don't know if it is has something to do with that problem but we had to patch 4.1.0 version of es6-promise in our geoportal-accesslib project : https://github.com/IGNF/geoportal-access-lib/blob/master/lib/es6-promise/es6-promise-4.1.0.js (reason here : https://github.com/IGNF/geoportal-access-lib/blob/6ff4fe4d9a3255881d333daa4440b3a3331c8a75/src/Config.js#L8)

tbroyer commented 7 years ago

Has anyone tried with IE11 during the last 8 months or so?

We updated es6-promise from 3.2.1 to 4.0.5 in https://github.com/iTowns/itowns/commit/79bcca060ff3706cdab983dc52bd97224b11b2fc, and es6-promise added an es6-promise/auto in 4.0 for auto-polyfilling, with es6-promise not (no longer, as I understand it) auto-polyfilling.

Could someone with an IE11 test if changing es6-promise to es6-promise/auto in webpack.config.js would fix the behavior? (and not break it in any other browser btw)

autra commented 7 years ago

I confirm the bug and will try your fix @tbroyer

But please note that it is not the only problem with IE11. I have tested this summer, and while I didn't have this Promise issue, we are using some string functions that are not in IE11 (and there are possibly other problems hidden behind).

I won't have any bandwidth to work on IE11 support before the end of october unfortunately. Is it worthy to support it anyway?

tbroyer commented 7 years ago

Might be worth trying babel-polyfill instead of es6-promise to polyfill more than just promises?

Also, our samples use Promise in places not processed by Babel/Webpack (that's a slightly different matter though, but still limits testing)

peppsac commented 7 years ago

I just tested babel-polyfill and it looks better than es6-promise since it also emulates String.includes.

But IE doesn't support URL so I had to add url-polyfill to get iTowns running.

With these changes some samples work on IE11:

On my laptop all globe-based examples are broken, because this laptop doesn't have log_depth_buffer support. It would be fixable by using sensitive bad near/far values for the camera though...