I've built a web app using require.js, and successfully used r.js to combine all module definitions into a single file.
Once the r.js optimized file has been created, I expected to just be able to require the optimized file on its own, but it fails to execute any of code after loading and defining the modules:
require([
'app1/optimizedAppFile'
], function (optimizedApp) {
//optimizedApp is undefined, even though it loaded
//the file and executed the module definitions in debugger
});
Is it appropriate to load / instantiate the app by defining the path to the top level module of the optimized file in require.config.js, and then requiring that in main.js? i.e.
requirejs.config({
paths: {
'optimizedApp.topLevelModule' : 'app1/optimizedAppFile'
//optimizedApp.topLevelModule is the full module name
//app1/optimizedAppFile is the combined file from r.js
}
});
optimizedApp
notoptimizedAppFile
. – Louis