Managed to solve this a couple of days ago. Now using Almond to load in my optimised r.js build and so I use a config like this:
compile: {
options: {
name: 'vendor/almond/almond',
baseUrl: 'lib',
include: ['main'],
insertRequire: ['main'],
mainConfigFile: 'lib/config.js',
out: 'dist/js/master.js',
optimizeAllPluginResources: true,
wrap: true
}
}
For the development version I had to include the config inside a different script below where I inserted require.js:
<script src="config.js"></script>
But for the optimiser I had to load config as a module: e.g.
require(['backbone','jquery','config'], function( Backbone, $ ) {
I couldn't get nested requires to work, so this is the solution that I came up with. Posting this for future Googlers.