I've been trying to save some ajax calls on my production environment. For that, I have bundled and minified some of my scripts but I'm struggling with select2 and it's translation files.
I've included jQuery + bootstrap + (lots of deps) + select2 + select2 i18n files on a built.js and set the shim values (tho i don't think it's needed).
Both jquery and select2 are pasted before the i18n files.
Added the following config (on production environment):
requirejs.config({
bundles: {
'built': [
'jquery',
'bootstrap',
'highcharts',
'bootbox',
'datatables',
'datatables-bootstrap',
'i18n',
'moment',
'knockout',
'knockout-mapping',
'pnotify',
'pnotify.nonblock',
'pnotify.desktop',
'pnotify.buttons',
'select2/select2',
'select2/i18n/pt-BR',
'select2/i18n/es',
'select2/i18n/en'
]
}
});
However, when I try to load my application with all minified resources I get an error on the console:
Uncaught TypeError: Cannot read property 'define' of undefined
On this line:
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function()
After few seconds when waitSecondsTimeout expires:
Uncaught Error: Load timeout for modules: select2/i18n/pt-BR,select2/i18n/es,select2/i18n/en
Application works well without the built files.