能打包但是console.log去不掉
gulp.task("agency:build", ["agency:cache-templates"], function (cb) {
agencySource.js.src.push(agencySource.build.cache + "/app.js");
pump(
[
gulp
.src(agencySource.js.src)
.pipe(envify({ NODE_ENV: 'production' }))
.pipe(stripDebug())
.pipe(ngAnnotate())
.pipe(babel())
.pipe(concat("app.js")),
//process.env.NODE_ENV
uglify({ drop_console: true}),
gulp.dest(agencySource.build.cache)
// .pipe(concat('app.js'))
// .pipe(gulp.dest(agencySource.build.cache))
],
cb
);
});
找到了一部分答案,但是效果不完全,只能去掉一部分console
uglify({
compress: {
warnings: false,
drop_console: true, // 过滤 console
drop_debugger: true // 过滤 debugger
}
})
用了之后console.log从1200多个变成了800多个~~~~
再用
`window.console.log = function() {}`屏蔽多余的console
希望还能优化一,怎么吧多余的console去掉
求大佬们来拯救一波~!!!谢谢
完美解决