From 02f98cd7e6b04cad51512ccbcd590d055130c70c Mon Sep 17 00:00:00 2001 From: Crawl Date: Wed, 22 Aug 2018 05:05:11 +0200 Subject: [PATCH] fix(webpack): properly minifying --- package.json | 2 +- webpack.config.js | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 9f4e7fec2..026823c22 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "tslint-config-typings": "^0.3.1", "typescript": "^3.0.1", "uglifyjs-webpack-plugin": "^1.3.0", - "webpack": "^4.16.5", + "webpack": "^4.17.0", "webpack-cli": "^3.1.0" }, "engines": { diff --git a/webpack.config.js b/webpack.config.js index c4ec147af..b845d3bd0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,22 +3,8 @@ const webpack = require('webpack'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const version = require('./package.json').version; -const plugins = [ - new webpack.optimize.ModuleConcatenationPlugin(), -]; - const prod = process.env.NODE_ENV === 'production'; -if (prod) { - plugins.push(new UglifyJSPlugin({ - uglifyOptions: { - mangle: { keep_classnames: true }, - compress: { keep_classnames: true }, - output: { comments: false }, - }, - })); -} - // eslint-disable-next-line max-len const filename = `discord${process.env.VERSIONED ? `.${version}` : ''}${prod ? '.min' : ''}.js`; @@ -53,10 +39,23 @@ module.exports = { child_process: 'empty', dgram: 'empty', __dirname: true, - process: false, + process: true, path: 'empty', Buffer: false, zlib: 'empty', }, - plugins, + optimization: { + minimizer: [ + new UglifyJSPlugin({ + uglifyOptions: { + mangle: { keep_classnames: true }, + compress: { keep_classnames: true }, + output: { comments: false }, + }, + }), + ], + }, + plugins: [ + new webpack.optimize.ModuleConcatenationPlugin(), + ], };