From d4dd5b50156a2f4fe06652c336a08606941a4389 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Thu, 25 Oct 2018 12:17:36 +0530 Subject: [PATCH] disable mangling for code more than 400kb --- gulpfile.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index dccfe2c..65dc89c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,10 +15,15 @@ var packageJson = JSON.parse(fs.readFileSync('./package.json')); function minifyJs(fileName) { const content = fs.readFileSync(fileName, 'utf8'); - const minifiedContent = babelMinify(content).code; + const minifiedContent = babelMinify( + content, + { mangle: content.length < 500000 }, + { sourceMaps: false } + ).code; fs.writeFileSync(fileName, minifiedContent); console.log( - `[${fileName}]: ${content.length}kb -> ${minifiedContent.length}kb` + `[${fileName}]: ${content.length / 1024}M -> ${minifiedContent.length / + 1024}M` ); } gulp.task('runWebpack', function() {