我试图按特定顺序连接和uglify javascript文件。当我禁用uglify时,它按照我的订单运行良好。但是当我打开uglify时,JS命令被忽略了。我做错了什么?
Script_1.js
let script_one = () => {
console.log(1);
};
Script_2.js
let script_two = () => {
console.log(2);
};
Gulp任务
gulp.task('js', function() {
return gulp.src(['js/Script1.js', 'js/Script2.js'])
.pipe(rigger())
.pipe(concat('main.js'))
.pipe(babel({presets: ['env']}))
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
输出
var script_two = function(){console.log(2)}; var script_one = function(){console.log(1)};
预期输出
var script_one = function(){console.log(1)}; var script_two = function(){console.log(2)};
没有Uglify的输出
var script_one = function(){
console.log(1)
};
var script_two = function(){
console.log(2)
};
谢谢!