marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

ngload problem when combined with grunt-contrib-requirejs #173

Open nicomelchiori opened 8 years ago

nicomelchiori commented 8 years ago

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?

marcoslin commented 8 years ago

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