能打包但是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
);
});找到了一部分答案,但是效果不完全,只能去掉一部分consoleuglify({
compress: {
warnings: false,
drop_console: true, // 過濾 console
drop_debugger: true // 過濾 debugger
}
})
用了之后console.log從1200多個(gè)變成了800多個(gè)~~~~
再用
`window.console.log = function() {}`屏蔽多余的console希望還能優(yōu)化一,怎么吧多余的console去掉求大佬們來拯救一波~?。。≈x謝
前端壓縮打包,能不能把console之類的去掉,找了答案,但是不行???
暮色呼如
2018-08-10 12:13:56