I have an optimized config.js configuration (about 420kB) loaded by requirejs, and every time a new user is logged in and the logs in this file are fetched and cached, but the first time the user fetches this, there is always Uncaught Error: Load timeout for modules: config, and then the user must upgrade and then download.
I thought this was a timeout problem, so it changed waitSeconds : 200. This happened in requireJs 2.1.6, so I upgraded to the latest version 2.1.9 and still remained the same problem.
But if I do not use the optimizer and do not use the non-optimized configuration file (3KB), which downloads about 35-40 small js files (reduced), everything will be fine! But I want all the files to be optimized config.jsdue to fewer HTTP requests (useful for mobile devices).
Adding code:
require.config({
paths : {
jquery : './vendor/libs/jquery-1.10.1.min',
underscore : './vendor/libs/underscore-min',
backbone : './vendor/libs/backbone-min',
marionette : './vendor/libs/backbone.marionette',
wreqr : './vendor/plugins/backbone.wreqr.min',
text : './vendor/plugins/text',
tpl : './vendor/plugins/tpl',
socketio : '../socket.io/socket.io.min',
spin : './vendor/plugins/spin.min',
shuffle : './vendor/plugins/jquery.shuffleLetters',
magicSuggest : './vendor/plugins/magicsuggest-1.3.0-min',
mCustomScroll : './vendor/plugins/jquery.mCustomScrollbar.concat.min',
imagesloaded : './vendor/plugins/imagesloaded',
qTip : './vendor/plugins/jquery.qtip.min',
visibility : './vendor/plugins/visibility',
tab : './vendor/plugins/tab',
dropdown : './vendor/plugins/dropdown',
interestsMap : './interestsMap',
moment : './vendor/plugins/moment.min',
favicon : './vendor/plugins/tinycon'
},
waitSeconds : 180,
shim : {
socketio : {
exports : 'io'
},
underscore : {
exports : '_'
},
backbone : {
deps : ['underscore','jquery'],
exports : 'Backbone'
},
marionette : {
deps : ['backbone'],
exports : 'Backbone.Marionette'
},
wreqr : {
deps : ['backbone'],
exports : 'Backbone.Wreqr'
},
shuffle : {
deps : ['jquery'],
exports : 'jQuery.fn.shuffleLetters'
},
magicSuggest : {
deps : ['jquery'],
exports : 'jQuery.fn.magicSuggest'
},
mCustomScroll : {
deps : ['jquery'],
exports : 'jQuery.fn.mCustomScrollbar'
},
visibility : {
exports : 'Visibility'
},
tab : {
deps : ['jquery'],
exports : 'jQuery.fn.tab'
},
dropdown : {
deps : ['jquery'],
exports : 'jQuery.fn.dropdown'
},
moment : {
exports : 'moment'
},
favicon : {
exports : 'Tinycon'
}
},
tpl : {
extension : '.tpl'
}
});
require([
'backbone',
'routers/index',
'app',
],function (Backbone ,Router ,app){
app.start();
Backbone.history.start();
});
** There are no errors in any of the modules, as there are small files with an unoptimized config.js file.
Assembly configuration
({
appDir : '../',
baseUrl: './scripts',
dir : '../../dist',
mainConfigFile : '../scripts/config.js',
name: "config",
optimizeCss : 'standard'
})