-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
importmaps do not work inside imported modules #200
Comments
So the polyfill guarantee is clearly defined as only polyfilling static module graphs that fail. Because you are using dynamic import and the module is otherwise succeeding in its static graph execution, the graph you are executing there is not being polyfilled by this project. This is described in more detail in https://github.com/guybedford/es-module-shims#polyfill-mode-details. You can achieve what you are after by using |
In the main HTML code, I have (had) this definition -
To my (incomplete) knowledge of the module spec, this use-case is both 1) a static import (that is, I am not doing
This works as desired in the latest Chrome and Firefox, but in Safari I get |
Because in the case of a 404 an actual request is sent, this isn't on the polyfill "optimum path" and so isn't polyfilled. You don't really want to be sending an unnecessary request in production ideally, and the polyfill would have to wait a full RTT before it knows it needs to engage which would have a performance cost. I guess an even stricter definition would be: The polyfill kicks in if there is a static link-time error - specifically either a syntax error or a resolution error. Fetch errors and runtime errors are not part of the polyfill path. Per the documentation you should add |
Would definitely be good to tackle these questions better in the docs, so thank you for your feedback here! Let me know if adding async solves that Safari issue for you? |
Closing as import maps work equivalently to native here, so if it works natively it will work in the polyfill. ES Module Shims now better handles import map attachment to never hit cases like this anymore, although do note that multiple import maps and import maps with src attributes are not supported in polyfill mode per the documentation to match native. |
Hi,
When I import a module that loads another module (that is also defined in the importmap), the polyfill behavior is as if the sourcemap does not exist.
For example, I have an import map like this -
And when
a.js
tries toimport "./b.js";
, this works as expected in current Chrome, but will fails in current Firefox and Safari.Minimal reproduction at https://glitch.com/edit/#!/hissing-humdrum-hyacinth?path=index.html%3A1%3A0
There are two related issues #199 and #168 but in my example, I'm following the main rule for the polyfil - that the first
import
should fail for the polyfill to take over module resolution - and it's still no finding my hashed filenames.The text was updated successfully, but these errors were encountered: