3.3.2.11. Overriding the dependency of a native AMD module

While declaring a native AMD module, the module dependency names must match with the AMD dependencies declared in the define function arguments. When there is a mismatch between a module declared in the native module and the module system of eXo Platform, the as tag can be used to rename the dependencies.

There is a foo.js file defining an AMD module named foo with two dependencies ["dep1", "dep2"] as follows:

define("foo", ["dep1", "dep2"], function(a1, a2) {
// The module
});

Supposing that the dependencies are declared as module1 and module2 in eXo Platform and the names do not match. To override them, use the as tag to rename the dependencies:


<module>
  <name>foo</name>
  <script>
    <path>/path/to/foo.js</path>
  </script>
  <depends>
    <module>module1</module>
    <as>dep1</as>
  </depends>
 <depends>
   <module>module2</module>
   <as>dep2</as>
 </depends>
</module>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus