Marius Gundersen (2014-01-28T07:53:54.000Z)
domenic at domenicdenicola.com (2014-01-31T14:49:17.727Z)
On Tue, Jan 28, 2014 at 2:13 AM, James Burke <jrburke at gmail.com> wrote: > In the AMD world, map config has been sufficient for these needs[1]. > > As a point of reference, requirejs only lets the first module > registration win, any subsequent registrations for the same module ID > are ignored. "ignore" was chosen over "error" because with multiple > module bundles, the same module ID/definition could show up in two > different bundles (think multi-page apps that have a "common" and > page-specific bundles). > AFAIK ES-6 modules cannot be bundled (yet). But if/when they can be bundled this is an argument for silently ignoring duplicates > I do not believe that case should trigger an error. It is just > inefficient, and tooling for bundles could offer to enforce finding > these inefficiencies vs the browser stopping the app from working by > throwing an error. > > It is true that the errors introduced by "ignore" could be harder to > detect given that things may mostly work. The general guide in this > case for requirejs was to be flexible in the same spirit of HTML > parsing. Since the imperative API through the Loader object uses promises, there is the option to reject the promise rather than throwing an error. This would let the developer handle the duplicate if they want to, but wouldn't require wrapping the API calls in `try{}catch`.