-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Examples: use import maps + polyfill #23255
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
Conversation
To test, open any example in Firefox / Safari https://raw.githack.com/mrdoob/three.js/6c7850ca2dd97d0bc503381ec44308c3eaeec8d5/examples/index.html |
I just tested in latest Chrome on Windows, it seems to work fine.
|
@looeee thanks for testing, that's expected behaviour since the polyfill can't disable native module loading. However as you can see, the example loads just fine 🙂 |
TBH, this change is premature. The support for import maps is not good enough that a wide usage in the repo is appropriate. I suggest to wait until all major browser support import maps with their latest version. And then use the polyfill to support older browsers. |
Judging by the https://threejs-journey.com/ course, seems like a a lot of people these days develop using bundlers and they are already doing This change is also one step forward on the Waiting for Firefox and Safari until we do the transition will probably delay it until 2023 at least... What are your main concerns about the change? |
That's indeed a long time... I'm just feeling a bit insecure to use an API which is not supported by two major browsers. On the other hand unifying the code import style is of course an important topic. Okay, it's probably best then to merge and see how the changes behave in production 👍 .
That sounds of course good, too! However, we should reopen #20455 or at least inform users like @Bug-Reaper and @gigablox when we are going to make this change. It seems there is still an unknown number of devs relying on ES5/UMD workflows and I think it's important to announce the removal in some way (similar when we removed |
Definitely. I would also be worried if Firefox hadn't expressed interest.
Agreed. I think we can continue generating the |
Thanks! |
woohoo! full steam ahead! great stuff @marcofugaro |
Related issue: #23175 (comment)
Description
Let's start using import maps in the examples!
In this PR I made all the
examples/jsm
files import from'three'
and added the import map + polyfill in the relative html file.I also updated the import in the file like this: