I am trying to save some ajax calls in my production environment. To do this, I linked and minimized some of my scripts, but I am struggling with select2 and its translation files.
I included jQuery + bootstrap + (many depots) + select2 + select2 i18n files on built.js and set the strip values (I don't think this is necessary).
Both jquery and select2 are inserted before i18n files.
The following configuration has been added (in production):
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 download my application with all limited resources, I get an error message on the console:
Uncaught TypeError: Unable to read the "define" property from undefined
In 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 a few seconds, when waitSecondsTimeout expires:
: : Select2/i18n/PT-BR, Select2/i18n/ES, Select2/i18n/
.