I'm not sure what causes this, but jquery-ui
doesn't seem to work after optimization.
Without optimization, the project runs fine. $
contains $.ui
. (Let's call this develop)
After optimization, functions depending on jquery-ui
fail because $.ui
does not exist.
I've been messing around with shims and requires for hours, but the result is always the same (or worse, $
not even working, although it still works in the non-optimized version.
What piece of logic am I missing?
requirejs.config({
baseUrl : 'js',
waitSeconds : 10,
urlArgs : 'cache='+Date.now(),
paths: {
"conf" : "remix/config",
"jquery" : "lib/jquery",
"jqueryUi" : "lib/jquery.ui",
"domReady" : "lib/domReady",
"bootstrap" : "lib/bootstrap",
"jsviews" : "lib/jsviews"
},
// I've had many configurations.
// Basically, develop almost always works, optimized never works.
shim: {
"jqueryUi" : {
deps : ['jquery']
},
"jsviews" : {
deps : ['jqueryUi']
},
"bootstrap" : {
deps : ['jsviews']
}
}
});
require(['domReady!', 'jsviews', 'jqueryUi', 'bootstrap'], function() {
console.log($);
// Develop: $.ui exists
// Optimized: $ exists, $.ui does not.
// (And jsviews only in some modules.)
});