【发布时间】:2014-05-27 22:30:16
【问题描述】:
我已经根据官方instructions 定义了一个简单的 Gruntfile.js,但是当我运行 grunt watch ('$ grunt watch') 或 grunt 默认任务 ('$ grunt') 时却收到警告。
错误是:
(节点)警告:检测到递归 process.nextTick。这将打破 在下一个版本的节点中。请使用 setImmediate 进行递归 延期。
我在这里阅读了相关的 StackOverflow 问题和答案:grunt throw "Recursive process.nextTick detected",但这并没有解决我的问题。
我的 Gruntfile.js 是:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['client/app/**/*.js'],
dest: 'client/dist/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
jshint: {
files: ['client/app/**/*.js', 'server/**/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
watch: {
files: ['<% jshint.files %>'],
tasks: ['jshint']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('default', ['watch']);
grunt.registerTask('test', ['jshint']);
grunt.registerTask('build-dev', ['jshint', 'concat']);
grunt.registerTask('build', ['jshint', 'concat', 'uglify']);
};
【问题讨论】:
标签: javascript node.js gruntjs