Why is RequireJS not working when using priority?
-
27-10-2019 - |
문제
When using RequireJS without "priority" it works:
require(
{},
[
'js/libs/jquery/jquery-1.4.4.js',
'js/libs/utils.js',
'js/app/app.index.js',
'js/app/app.framework.js',
'js/app.modules/app.modules.navigation.js'
],
function() {
require.ready(function() {
console.log('require is done and dom is ready');
app.name = 'myApp';
app.init();
});
}
);
But once i add "priority", it stops working:
require(
{
priority: [
'js/libs/jquery/jquery-1.4.4.js',
'js/libs/utils.js',
'js/app/app.blueprint.js',
'js/app/app.framework.js'
]
},
[
'js/libs/jquery/jquery-1.4.4.js',
'js/libs/utils.js',
'js/app/app.index.js',
'js/app/app.framework.js',
'js/app.modules/app.modules.navigation.js'
],
function() {
require.ready(function() {
console.log('require is done and dom is ready');
app.name = 'myApp';
app.init();
});
}
);
What am i doing wrong?
p.s. And for anyone wondering why I do not use the RequireJS-jQuery, is a preference thing =]
해결책
Okay, so the issue was a small bug in requirejs which James Burke fixed in the latest commit of requirejs: https://github.com/jrburke/requirejs/commit/9be3d7d01db380c1014d9cc393be2762e3c78044
It will go in the next release possibly in the upcoming weeks.
Reference: http://groups.google.com/group/requirejs/browse_thread/thread/4d8f5bce44dff57d
제휴하지 않습니다 StackOverflow