After I optimize an AMD module and it's dependencies using r.js I get this error....
Uncaught TypeError: undefined is not a function
If I load the unoptimized AMD module and have requirejs dynamically load all its dependencies, it works fine.
Here's how I load the module...
require(['jquery', "templates/mainmodule"],
function ($, mainmodule) {
var mainModuleObject = new mainmodule();
}
The main module and its dependencies are properly retrieved (I see it using Fiddler), but the main module is undefined when I try to instantiate it. My config mappings are proper, and shims for Underscore and jquery are also fine. Not using Backbone. Have exports for all non-AMD modules. There are no module loading errors appearing in console.
Ideas on how I can troubleshoot this?