From 2a9c5a52b436f97f45e8f6cb959e70a03da17cf7 Mon Sep 17 00:00:00 2001 From: weyusi Date: Wed, 10 Apr 2019 19:24:02 +0930 Subject: [PATCH] feat: switch to terser for ES6 compatibility --- lib/filter.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/filter.js b/lib/filter.js index acfd637..eb84a0b 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -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 diff --git a/package.json b/package.json index 56d6c1d..9025cf6 100644 --- a/package.json +++ b/package.json @@ -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",