Grunt requirejs nested dependencies
I have a config file with all path and shim data :
require.config({
paths : {
'jquery' : 'libs/jquery-1.10.2.min',
'backbone' : 'libs/backbone-min',
'underscore' : 'libs/underscore-min',
'layer' : 'src/views/base/LayerView'
...
},
shim : {
'backbone': {
deps : ['underscore', 'jquery'],
exports : 'Backbone'
},
'underscore' : {
exports : '_'
},
}
});
And a main file as app starting point:
require(['./config'], function (config) {
require(['jquery', 'underscore', 'backbone', 'src/router/PageRouter'], function($, _, Backbone, PageRouter) {
new PageRouter();
Backbone.history.start();
});
});
if I run the grunt requirejs task, it doesn't include the dependencies:
options: {
baseUrl : '_js',
name : "src/main",
mainConfigFile : basePath + '_js/src/main.js',
out : basePath + '_js/min/script.min.js',
normalizeDirDefines : 'all'
}
What am I doing wrong?
simple solution is to enable findNestedDependencies flag.
you might want to get rid of nested dependencies, see seperating config file, and deps config and explanation.
链接地址: http://www.djcxy.com/p/93638.html上一篇: 为什么我的咕噜声