I'm using requirejs to load some libraries and dependencies.
When I just load jQuery, it's working perfectly:
main.js
require.config({
shim: {
jquery: {
exports: '$'
}
},
paths: {
jquery: 'vendor/jquery'
}
});
require([
'vendor/jquery',
'app/init'
]);
app/init.js
define(
['jquery'],
function ($) {
$(document).ready(function () {
console.log('domready');
})
}
)
But when I try to add underscore, in the network panel the file is correctly loaded but in the console I get a
Uncaught Error: Load timeout for modules: underscore
What's happening?
I also tried the waitSeconds: 200 options inside the require.config without any success.
Below the final (broken) code as a reference:
main.js
require.config({
shim: {
jquery: {
exports: '$'
},
underscore: {
exports: '_'
}
},
paths: {
jquery: 'vendor/jquery',
underscore: 'vendor/underscore',
}
})
require([
'vendor/jquery',
'vendor/underscore',
'app/init'
])
app/init.js
define(
['jquery', 'underscore'],
function ($, _) {
$(document).ready(function () {
console.log('domready');
})
}
)