How to solve this basic ES6-module circular dependency problem?
John Lenz
concavelenz at gmail.com
Wed Aug 10 00:36:27 UTC 2016
Without a way to load "later" (aka "soft") dependencies, ES6 module will
continue to be more or less broken for circular dependencies.
On Tue, Aug 9, 2016 at 4:11 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Tue, Aug 9, 2016 at 4:00 PM, /#!/JoePea <joe at trusktr.io> wrote:
> > True, and so that's why I'm wondering if the module system can see that
> it
> > can satisfy all module requirements if it simply evaluates module C
> first,
> > followed by A or B in any order. It is easy for us humans to see that. It
> > would be nice for the module system to see that as well (I'm not sure if
> > that is spec'd or not).
>
> That knowledge requires, at minimum, evaluating the rest of each
> module, beyond what is expressed in the `import` statements. That's
> assuming there's no dynamic trickery going on that would invalidate
> whatever assumptions it can draw from surface-level analysis.
>
> Because of this, only the `import` statements are declaratively
> available to the module system to work with. Based on that, it
> definitely can't make any ordering assumptions; all it knows is that A
> imports C, B imports C, and C imports both A and B, making a circular
> import.
>
> ~TJ
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160809/a9c0c2de/attachment.html>
More information about the es-discuss
mailing list