mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 14:02:02 +00:00
fix(webpack): properly minifying
This commit is contained in:
parent
928fb30040
commit
02f98cd7e6
2 changed files with 16 additions and 17 deletions
|
|
@ -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(),
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue