I'm very interested in module loaders for node.js and also the new harmony modules specification.
In general, I like the spec, but there is a problem that I'm not sure about how it is solved.
If one wants to build a cross-platform JavaScript library, it's sometimes necessary to use different libraries on different platforms for the same job. For example, the Buffer module in node.js, does not exist in the Browser, so one would have to write an abstraction module which loads, depending on the platform, different code.
Since harmony resolves the dependencies before the execution of any code, how can it know, that it only has to load the code for one platform, and not for all?
In the browser, I don't want to load code that only runs in node.js, so how is this problem solved?