我有一个问题,我的grunt-contrib-requirejs
任务停止了我的 grunt 进程。它完全没有错误地做到这一点。我需要帮助确定问题。
我的总体任务
grunt.registerTask('build', [
'clean:dist',
'jshint',
'handlebars',
'requirejs',
'concat:dist',
'uglify',
'compass',
'imagemin',
'cssmin',
'copy'
]);
这是我的任务配置
requirejs: {
dist: {
options: {
baseUrl: 'app',
optimize: 'none',
optimizeCss: 'none', // We use cssmin for this
preserveLicenseComments: true,
dir: 'dist/',
useStrict: true,
wrap: false,
findNestedDependencies: true,
//If set to true, any files that were combined into a build bundle will be
//removed from the output folder.
removeCombined: true,
paths: {
aura: '<%= settings.bower %>/aura/lib/aura',
underscore: '<%= settings.bower %>/underscore/underscore',
eventemitter: '<%= settings.bower %>/eventemitter2/lib/eventemitter2',
backbone: '<%= settings.bower %>/backbone/backbone',
handlebars: '<%= settings.bower %>/handlebars/handlebars',
text: '<%= settings.bower %>/requirejs-text/text',
jquery: '<%= settings.bower %>/jquery/jquery'
},
shim: {
backbone: {
exports: 'Backbone',
deps: ['underscore', 'jquery']
},
underscore: {
exports: '_'
},
handlebars: {
exports: 'Handlebars'
}
},
modules: [{
name: "app",
include: ["aura","jquery"]
}],
onBuildWrite: function( name, path, contents ) {
grunt.log.writeln( 'Writing: ' + name );
return contents
},
done: function(done, output) {
var duplicates = require('rjs-build-analysis').duplicates(output);
if (duplicates.length > 0) {
grunt.log.subhead('Duplicates found in requirejs build:');
grunt.log.warn(duplicates);
done(new Error('r.js built duplicate modules, please check the excludes option.'));
}
grunt.log.writeln('All done');
done();
}
}
}
}
我尝试使用-v
标志运行它,但没有收到任何错误或警告。然后它就停止了,并且不运行我定义的其他任务,我没有得到我定义的自定义日志记录。我得到这个输出:
Running "requirejs" task
Running "requirejs:dist" (requirejs) task
Verifying property requirejs.dist exists in config...OK
File: [no files]
Options: logLevel=0, done=undefined, baseUrl="app", optimize="none", optimizeCss="none", preserveLicenseComments, dir="dist/", useStrict, wrap=false, findNestedDependencies, removeCombined, paths={"aura":"bower_components/aura/lib/aura","underscore":
"bower_components/underscore/underscore","eventemitter":"bower_components/eventemitter2/lib/eventemitter2","backbone":"bower_components/backbone/backbone","handlebars":"bower_components/handlebars/handlebars","text":"bower_components/requirejs-text/t
ext","jquery":"bower_components/jquery/jquery"}, shim={"backbone":{"exports":"Backbone","deps":["underscore","jquery"]},"underscore":{"exports":"_"},"handlebars":{"exports":"Handlebars"}}, modules=[{"name":"app","include":["aura","jquery"]}], onBuild
Write=undefined
>> Tracing dependencies for: app
从这个输出看来, done 函数没有定义,但我确实定义了它,我什至使用了grunt-contrib-requirejs 自述文件中的一个例子中的一个例子。
我正在使用grunt@0.4.1
和。节点是版本grunt-contrib-requirejs@0.4.1
requirejs@2.1.8
v0.8.16
更新一
我尝试升级我的节点,我现在开始了,v0.10.17
但这里没有任何变化。
我aura
从我的模块中删除了包括,它现在看起来像这样:
modules: [{
name: "app",
include: ["jquery"]
}],
这给了我更多的输入,但它仍然停止了我的 Grunt,并且没有运行我的完成功能,我得到了这个输出:
>> app.js
>> ----------------
>> bower_components/aura/lib/platform.js
>> bower_components/aura/lib/base.js
>> bower_components/aura/lib/logger.js
>> bower_components/aura/lib/aura.extensions.js
>> bower_components/aura/lib/aura.js
>> app.js