2018-12-04 10:19:10 +13:00
|
|
|
'use strict';
|
|
|
|
|
2017-10-23 01:45:32 +13:00
|
|
|
const path = require('path');
|
2018-09-19 11:20:07 +12:00
|
|
|
const TerserJSPlugin = require('terser-webpack-plugin');
|
2016-11-21 13:38:16 +13:00
|
|
|
const version = require('./package.json').version;
|
|
|
|
|
2017-10-26 10:09:36 +13:00
|
|
|
const prod = process.env.NODE_ENV === 'production';
|
2016-11-21 13:38:16 +13:00
|
|
|
|
2017-10-26 10:09:36 +13:00
|
|
|
// eslint-disable-next-line max-len
|
|
|
|
const filename = `discord${process.env.VERSIONED ? `.${version}` : ''}${prod ? '.min' : ''}.js`;
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: './src/index.js',
|
2018-04-11 23:49:42 +12:00
|
|
|
mode: prod ? 'production' : 'development',
|
2017-10-26 10:09:36 +13:00
|
|
|
output: {
|
|
|
|
path: path.resolve('./webpack'),
|
|
|
|
filename,
|
|
|
|
library: 'Discord',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{ test: /\.md$/, loader: 'ignore-loader' },
|
|
|
|
{
|
|
|
|
test: require.resolve('./package.json'),
|
2018-04-11 23:49:42 +12:00
|
|
|
type: 'javascript/auto',
|
2017-10-26 10:09:36 +13:00
|
|
|
use: {
|
|
|
|
loader: 'json-filter-loader',
|
|
|
|
options: {
|
|
|
|
used: ['version', 'homepage'],
|
2017-10-23 01:45:32 +13:00
|
|
|
},
|
|
|
|
},
|
2017-10-26 10:09:36 +13:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
fs: 'empty',
|
|
|
|
dns: 'mock',
|
|
|
|
tls: 'mock',
|
|
|
|
child_process: 'empty',
|
|
|
|
dgram: 'empty',
|
|
|
|
__dirname: true,
|
2018-08-22 15:05:11 +12:00
|
|
|
process: true,
|
2017-10-26 10:09:36 +13:00
|
|
|
path: 'empty',
|
2020-04-21 07:15:26 +12:00
|
|
|
Buffer: true,
|
2017-10-26 10:09:36 +13:00
|
|
|
zlib: 'empty',
|
|
|
|
},
|
2018-08-22 15:05:11 +12:00
|
|
|
optimization: {
|
2020-08-15 07:46:23 +12:00
|
|
|
minimize: true,
|
2018-08-22 15:05:11 +12:00
|
|
|
minimizer: [
|
2018-09-19 11:20:07 +12:00
|
|
|
new TerserJSPlugin({
|
2020-10-20 05:46:49 +13:00
|
|
|
cache: false,
|
2018-09-19 11:20:07 +12:00
|
|
|
terserOptions: {
|
2020-08-15 07:46:23 +12:00
|
|
|
mangle: { keep_classnames: true, keep_fnames: true },
|
2019-09-08 21:46:47 +12:00
|
|
|
keep_classnames: true,
|
2020-08-15 07:46:23 +12:00
|
|
|
keep_fnames: true,
|
2018-08-22 15:05:11 +12:00
|
|
|
output: { comments: false },
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
},
|
2016-11-21 13:38:16 +13:00
|
|
|
};
|