diff --git a/lib/filter.js b/lib/filter.js index 53f9114..872c281 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -72,14 +72,14 @@ function logicJs (str, data) { } // Terser doesn't like unsupported options - delete options.enable - delete options.exclude - let jsLogger = options.logger - delete options.logger + const jsOptions = Object.assign({}, options) + delete jsOptions.enable + delete jsOptions.exclude + delete jsOptions.logger - let result = Terser.minify(str, options) + let result = Terser.minify(str, jsOptions) let saved = ((str.length - result.code.length) / str.length * 100).toFixed(2) - if (jsLogger) { + if (options.logger) { let log = hexo.log || console.log log.log('Minify the js: %s [%s saved]', path, saved + '%') }