mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-28 01:00:13 +02:00
disable mangling for code more than 400kb
This commit is contained in:
@@ -15,10 +15,15 @@ var packageJson = JSON.parse(fs.readFileSync('./package.json'));
|
|||||||
|
|
||||||
function minifyJs(fileName) {
|
function minifyJs(fileName) {
|
||||||
const content = fs.readFileSync(fileName, 'utf8');
|
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);
|
fs.writeFileSync(fileName, minifiedContent);
|
||||||
console.log(
|
console.log(
|
||||||
`[${fileName}]: ${content.length}kb -> ${minifiedContent.length}kb`
|
`[${fileName}]: ${content.length / 1024}M -> ${minifiedContent.length /
|
||||||
|
1024}M`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
gulp.task('runWebpack', function() {
|
gulp.task('runWebpack', function() {
|
||||||
|
Reference in New Issue
Block a user