0 Replies Latest reply on Jan 4, 2016 6:07 AM by fusion35

    AMD dependencies

    fusion35

      Hi :

      I'm trying to load js defined in theme via AMD loader. This is to take advantage of the OOB modules and the ones that I defined in the theme. The dependencies specified either in define() or require() don't seem to work.

      Use case 1 : I have a js defined under js/xyz/mymodule.js. It looks like this..

      define('mymodule', ['jquery'], function($) {

          console.log('Inside mymodule');

      });

      later when I try to use it in another js that doesn't work..

      require(

          [

              'jquery',

              'mymodule'

          ],

          function($, mod) {

              console.log('About to init ...');

              return new mod();

          });

      Please note if I remove mymodule from the list and leave jQuery alone, it works.

       

      Use Case2 : Trying to use an OOB module id. Let's say I have use an OOB module as dependency, even that doesn't work. Example,

       

      require(

          [

              'jquery',

              'apps/news/menu/views/nav_link'

          ],

          function($, nav) {

              console.log('About to init ...');

              return new nav();

          });