I have a custom browser app which loads some Dojo AMD modules with a require call, and I'm trying to create a custom Dojo build to remove the overhead of loading several JS files with every page load.
My app's code is non-AMD. It calls require in global-level code as soon as the browser loads my JS file. This works fine in development, and I want to avoid changing it to AMD if possible.
To this end, I want a build that combines my required Dojo modules and my app code into one minified JS file, but with my app code at the global level (not wrapped in any way) so it works as-is.
I have the following profile.js file for my build. This nearly does what I want, but it wraps my app code in a function which prevents it from working. How do I tell the build process to not wrap my app code?
I'm currently using Dojo 1.10.10, but could upgrade that if it would help.
var profile = (function(){
var dojoBase='../../dojo-release-1.10.10-src/';
return {
basePath: './src',
releaseDir: '../release',
releaseName: 'main',
action: 'release',
cssOptimize:'comments',
mini:true,
stripConsole:'none',
selectorEngine:'acme',
packages:[{
name: 'dojo',
location: dojoBase+'dojo'
},{
name: 'dijit',
location: dojoBase+'dijit'
},{
name: 'dojox',
location: dojoBase+'dojox'
},{
name: 'app',
location: '.',
}],
layers:{
'main.min':{
include:['dojo/dojo','dojo/on','dojo/request/xhr','dojo/parser','dojo/query','dojo/dom-construct',
'dojo/dom-class','dojo/NodeList-dom','dojo/domReady','dijit/registry','dojox/widget/Toaster',
'app/main'],
customBase:true,
boot:true
}
}
};
})();