multiple modules with the same name

Jason Orendorff jason.orendorff at gmail.com
Mon Jan 27 14:08:35 PST 2014


On Mon, Jan 27, 2014 at 1:54 PM, Marius Gundersen <gundersen at gmail.com> wrote:
> I didn't find anything in the spec on handling multiple modules with the
> same name [...]
> What should happen in such a scenario? Should existing modules be
> replaced? Should an error be thrown? How would that work with the DOM?
> Should it be a no-op, with no feedback to the user?

Before a module is ever exposed to scripts, before its module body
runs, it is first linked. This binds it permanently with the other
modules it imports.

After that, if you call loader.set(name, otherModule), that only
changes the loader's module registry. It affects future module loads.
It does not affect any modules already linked to the original module
that you replaced. It does not affect any functions from that original
module that are already on the stack.

-j


More information about the es-discuss mailing list