feat: switch to terser for ES6 compatibility

This commit is contained in:
weyusi 2019-04-10 19:24:02 +09:30
parent 4c2b9e2d1f
commit 2a9c5a52b4
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* global hexo */
'use strict'
const CleanCSS = require('clean-css')
const UglifyJS = require('uglify-js')
const Terser = require('terser')
const Htmlminifier = require('html-minifier').minify
const Promise = require('bluebird')
const minimatch = require('minimatch')
@ -78,13 +78,13 @@ function logicJs (str, data) {
}
}
// uglifyjs doesn't like unsupported options
// Terser doesn't like unsupported options
delete options.enable
delete options.exclude
let jsLogger = options.logger
delete options.logger
let result = UglifyJS.minify(str, options)
let result = Terser.minify(str, options)
let saved = ((str.length - result.code.length) / str.length * 100).toFixed(2)
if (jsLogger) {
let log = hexo.log || console.log

View File

@ -23,7 +23,7 @@
"html-minifier": "^4.0.0",
"iltorb": "^2.4.2",
"minimatch": "^3.0.4",
"uglify-js": "^3.5.3"
"terser": "^3.17.0"
},
"keywords": [
"html",