Will it be possible to retrieve a loaded module's exports synchronously?
caridy at gmail.com
Wed Feb 24 23:08:47 UTC 2016
I’m not sure what are you trying to do, but from within the module itself, you will have access to some metadata about the module, we have been chatting about `import()` and `import.<key>` as the imperative forms to import relative modules, accessing module’s metadata, and potentially a reference to the loader instance bound to the module (thru module status), but all that in up in the air.
From outside, things are more complicated, you have access to the registry of every loader instance, you can walk each registry, and do what you please, but there is no guarantee that the module status that you’re looking for is accessible (they can be removed from the registry and still function).
You should probably post this question on whatwg/loader repo.
> On Feb 24, 2016, at 5:58 PM, John Lenz <concavelenz at gmail.com> wrote:
> I'm trying to plan a migration to ES6 modules. For interop with the existing systems in the short-medium term, I would like to be able to retrieve a loaded modules exports synchronously (basically a "get or fail").
> It looks like retrieving the exports synchronously is possible using the Registry object, however the registry requires that you have an appropriate "key". The "key" appears to only be resolvable asynchronously which means the whole operation must async.
> Am I missing something?
More information about the es-discuss