Marius Gundersen (2014-01-27T23:24:52.000Z)
domenic at domenicdenicola.com (2014-01-31T14:45:11.030Z)
> Guy Bedford, based on experiences within the requirejs and commonjs worlds, has a much better solution for these scenarios. (It's also similar to how npm works). > > Your jQuery should depend upon the name X, but you Loader should map the name X when loaded by jQuery to the new version in Loader.normalize(). The table of name mappings can be configured at run time. > > For example, if some other code depends on X at 1.6 and jQuery needs X at 1.7, they each load exactly the version they need because the normalized module names embed the version number. This seems to handle the scenario where two versions is wanted. This would probably also work in the scenario where a unique instance of the same version should be given to every module depending on it. This would be useful for unit tests, where a clean world is required for each tests. Or for unit test maybe a new realm should be used for each test. If a module is redefined with imperative code then an error should probably be thrown, or the promise could be rejected. But I don't think that would be good for DOM manipulation. If innerHTML is used to add a lot of markup and an existing module to the DOM, should an error be thrown? Should none of the other markup be added to the DOM? What would the error message look like to adequately indicate the source of the error?