mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fix(webpack): properly minifying
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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(),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user