I've successfully run the r.js optimizer and everything seems to be working fine. However, I am facing an issue where the compressed optimized version loads along with all the uncompressed modules. Any idea why this might be happening?
build.js
{
appDir: '../static',
mainConfigFile: '../static/javascript/config.js',
dir: '../public',
baseUrl: 'javascript/libs',
useStrict: false,
wrap: false,
optimizeCss: "standard",
optimize: "uglify2",
generateSourceMaps: false,
preserveLicenseComments: false,
uglify2: {
"screw-ie8": true,
warnings: false,
mangle: true
},
throwWhen: {
optimize: true
},
pragmasOnSave: {},
modules: [
{
name: '../front',
include: ['views/front/main'],
exclude: ['../config']
}
,
{
name: '../portal',
include: ['views/portal/main'],
exclude: ['../config']
}
,
{
name: '../survey',
include: ['views/survey/main'],
exclude: ['../config']
}
]
}
config.js
require.config({
baseUrl: '/javascript/libs',
urlArgs: 'v=' + (new Date()).getTime(),
enforceDefine: false,
paths: {
collections: '../collections',
etc: '../etc',
models: '../models',
views: '../views',
templates: '../../templates',
backbone: 'backbone',
underscore: 'lodash',
'underscore.string': 'underscore.string',
},
shim: {
backbone: {
deps: ['jquery', 'underscore'],
exports: 'Backbone'
},
underscore: {
deps: ['jquery', 'underscore.string'],
exports: '_'
},
}
});
The config is loaded in the following way:
<script data-main="/javascript/portal-v2.0.0.js" src="/javascript/libs/require.js"></script>
and portal.js is structured like this:
require(['./config'], function() {
return require(['views/portal/main']);
});