@mbostock It should be possible, I think. If we assume that d3-require "owns" window.define, then redefining the property should not cause any issues. In addition, d3-require could set a flag on window, potentially also a reference to the Set of callbacks.
The workaround is somewhat primitive though and needs a lot more testing with packages that add global identifiers (e.g. Leaflet?), since the instance returned by d3-require might not match the one that's referenced globally.
If possible, the bridge function should call the define callbacks only until the first one succeeds. The current try/catch is misleading, since the factory call happens inside a promise.
Leaflet breaks as expected: Global instance and returned instance only match for the last call. But that's a pretty specific edge case, I think. In any case, I've expanded the tests.
The reason d3-require doesn’t have a global cache is because even though the URL is the same, transitive dependencies can be affected by require.alias/requireFrom:
https://github.com/d3/d3-require/issues/16