marcoslin/angularAMD

ngload problem when combined with grunt-contrib-requirejs

Opened this issue · 1 comments

Hi,
I wrote an entire app using this library and everything works great in development environment, having all requirejs module in an individual file.
I'm having problem when trying to optimize all modules. I'm currently using grunt-contrib-requirejs task for doing that.
This is the error I'm getting

Running "requirejs:compileApp" (requirejs) task
 TypeError: Cannot read property 'processQueue' of undefined
 In module tree:
     calendar/calendar.controller.index
       ngload

{ [Error: TypeError: Cannot read property 'processQueue' of undefined
In module tree:
    calendar/calendar.controller.index
      ngload
    at eval (eval at <anonymous> (/app/node_modules/grunt-contrib-requirejs/node_modules/requirejs/bin/r.js:24556:38), <anonymous>:13:25)
]
  originalError: 
   { [TypeError: Cannot read property 'processQueue' of undefined]
     moduleTree: [ 'ngload', 'calendar/calendar.controller.index' ],
     fileName: '/app/dist/app/ngload.js' } }

For some strange reason, ngload.js is being evaluated without injecting angularAMD dependency. If I check before angularAMD.processQueue(); if angularAMD is defined everything works as expected. Any clue on why this happens?

Can you share some sample code? Make sure to include your main.js.