mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
fix(webpack): properly minifying
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
"tslint-config-typings": "^0.3.1",
|
"tslint-config-typings": "^0.3.1",
|
||||||
"typescript": "^3.0.1",
|
"typescript": "^3.0.1",
|
||||||
"uglifyjs-webpack-plugin": "^1.3.0",
|
"uglifyjs-webpack-plugin": "^1.3.0",
|
||||||
"webpack": "^4.16.5",
|
"webpack": "^4.17.0",
|
||||||
"webpack-cli": "^3.1.0"
|
"webpack-cli": "^3.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -3,22 +3,8 @@ const webpack = require('webpack');
|
|||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||||
const version = require('./package.json').version;
|
const version = require('./package.json').version;
|
||||||
|
|
||||||
const plugins = [
|
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
|
||||||
];
|
|
||||||
|
|
||||||
const prod = process.env.NODE_ENV === 'production';
|
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
|
// eslint-disable-next-line max-len
|
||||||
const filename = `discord${process.env.VERSIONED ? `.${version}` : ''}${prod ? '.min' : ''}.js`;
|
const filename = `discord${process.env.VERSIONED ? `.${version}` : ''}${prod ? '.min' : ''}.js`;
|
||||||
|
|
||||||
@@ -53,10 +39,23 @@ module.exports = {
|
|||||||
child_process: 'empty',
|
child_process: 'empty',
|
||||||
dgram: 'empty',
|
dgram: 'empty',
|
||||||
__dirname: true,
|
__dirname: true,
|
||||||
process: false,
|
process: true,
|
||||||
path: 'empty',
|
path: 'empty',
|
||||||
Buffer: false,
|
Buffer: false,
|
||||||
zlib: 'empty',
|
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