In my require.config I create shorthands for a couple of paths that I use regularly:
require.config({
paths: {
text: 'components/requirejs-text/text',
url: 'config/url',
List: 'modules/List/main'
...
Then on the individual pages (in separate script files), I instantiate a module like this:
require(['List'], function(List){ new List; });
My plan was to optimise all files into one file, require that and instantiate a module as in my example, but since the paths of require.config aren't really relevant anymore (Because I now only have main.build.js) how can I instantiate my modules?
UPDATE: Let me rephrase:
I'm trying to instantiate a module outside of the optimised build script, how do I do that?
Wherever you want to include the List
module just create a new paths configuration which points to the optimized file.
require.config({
paths: {
'List': 'js/myApp'
}
});
require(['List'], function(List) {
...
});