Will it be possible to retrieve a loaded module's exports synchronously?
concavelenz at gmail.com
Wed Feb 24 23:47:09 UTC 2016
I'm trying to do exactly what it sounds (I hope): given a path and the
system loader registry, retrieve the module exports. This would allow an
action to be taken only if the module hand already be loaded without
forcing the module to be if it weren't.
On Wed, Feb 24, 2016 at 3:08 PM, Caridy Patiño <caridy at gmail.com> wrote:
> 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
> 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:
> > Background:
> > 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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss