From 9d281ec79fbfb419089e1ebf33e6e088a2c210b1 Mon Sep 17 00:00:00 2001 From: notgne2 Date: Mon, 23 Dec 2019 16:41:42 -0700 Subject: [PATCH] fix minification --- webpack.config.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 5860f24..77aee93 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,13 +20,16 @@ const magicFile = (text) => { // const magicAppend = (orig, text, sep = '\n') => magicFile(fs.readFileSync(orig) + sep + text) const jsMin = { - pure_funcs: ['F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'], - pure_getters: true, - keep_fargs: false, - unsafe_comps: true, - unsafe: true, - compress: true, mangle: true, + compress: { + keep_fargs: false, + pure_getters: true, + pure_funcs: ['F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'], + unsafe: true, + ecma: 6, + unsafe_comps: true, + unsafe_arrows: true, + } } const htmlMin = { @@ -107,10 +110,14 @@ module.exports = { } ], }, + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ terserOptions: jsMin }), + new TerserPlugin({ terserOptions: jsMin }), + ], + }, plugins: [ - new TerserPlugin({ - terserOptions: jsMin, - }), new CopyPlugin([{ from: 'data', to: 'data' }, { from: 'wand.js', to: 'wand.js' }]), new ImageminPlugin({ jpegtran: { progressive: true },