Conversation
905704b to
48e3227
Compare
|
Another thing we could do here to help solve the race issue in future is to support a new init option, |
There was a problem hiding this comment.
Thanks for tackling this!
The shim mode switch is definitely necessary. I would have thought the ep markers would have been conflict-avoiding here therefore this would be unnecessary.
This seems needed in some versions indeed. For example, 2.0.0 or 1.4.0 + Firefox
The defineValue(self, '_d', undefined) thing - what version this is deconflicting with and why.
I found about the _d here, which is code included in versions around 2.0.0 (removed in 2.0.3), including earlier versions like 1.10.
It's hard to reproduce but it happens in Safari with these versions sometimes. Changing the _d seemed to disable the checks in these versions. I'm not 100% sure about the mechanism, but I think that assigning undefined in _d propagates the undefined value to dynamicImport, and thanks to that it gets overwritten by this custom function 🤔 -- I'm not sure why the original u=>import(u) is problematic but it seems to create issues indeed (maybe it can't be rewritten by the first loaded polyfill? Unsure). It makes me suspect there might be some mixed behavior between the 2 loaded polyfills but I don't really know.
I've pushed a branch to my test repo with the patched polyfill, in case you want to test it: https://github.com/frandiox/importmap-polyfill-test/tree/fd-patch-test -- you can play with removing async attribute as well to ensure order.
Hope this is helpful!
Co-authored-by: Fran Dios <frankdiox@gmail.com>
|
Releasing in 2.4.0 now. |
Adds the hard version protections suggested in #484 - freezing the
importShimobject on the global and also freezing its properties.I would still like to verify before landing this:
epmarkers would have been conflict-avoiding here therefore this would be unnecessary.defineValue(self, '_d', undefined)thing - what version this is deconflicting with and why.