In my dojo app i am trying to dynamically load module which works fine until i build my code. Once code is build using dojo build system somehow the same module loads as an interger (specifically 3) rather than the module itself.
Below is the code that is working i.e. before building an app
var loadModule = "MyModule.js";
var path = "./js/path/to/MyModule/";
require([path+loadModule], lang.hitch(this,function (myModule) {
//do something with myModule
//this works without any problem
}))
Now the same piece of code when came through the dojo build system becomes something like below and doesn't work
var _23 = "MyModule.js";
var _24 = "./js/path/to/MyModule/";
require([_24 + _23], _2.hitch(this, function(_25) {
//here this '_25' is number 3 instead of myModule. which i wonder why!
}))
For the dojo build system i am using following configurations
layerOptimize: "shrinksafe",
optimize: "shrinksafe",
cssOptimize: "comments",
mini: true,
stripConsole: "warn",
selectorEngine: "lite",
Edit: Here in my application the module i am trying to load dynamically is responsible for dealing with openlayers map. The basic code for this module goes like below
define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/window", "dojo/dom", "dojo/dom-construct", "dojo/topic","dojo/dom-style","dojo/on",
"dijit/registry","dijit/Tooltip","dijit/TooltipDialog","dijit/popup","dijit/ConfirmDialog",
"dojox/collections/Dictionary"
],
function(declare, lang, baseWindow, dom, domConstruct, topic, domStyle, on,
registry,Tooltip,TooltipDialog,dijitPopup,ConfirmDialog,
Dictionary){
var olMapModule = {};
olMapModule.initMap = function(){
//Code for openlayer go here
};
olMapModule.initMapInteractions = function(){
//code for initiating the map interactions go here
};
return olMapModule;
});
Edit2: The comma was placed by mistake. Also the thing is, this piece of code does works perfect before going through the dojo build.