mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(webpack): properly emitting process deprecation warnings
This commit is contained in:
@@ -52,12 +52,12 @@
|
||||
"@types/node": "^9.4.6",
|
||||
"discord.js-docgen": "discordjs/docgen",
|
||||
"eslint": "^5.4.0",
|
||||
"parallel-webpack": "^2.2.0",
|
||||
"parallel-webpack": "^2.3.0",
|
||||
"tslint": "^3.15.1",
|
||||
"tslint-config-typings": "^0.2.4",
|
||||
"typescript": "^3.0.1",
|
||||
"uglifyjs-webpack-plugin": "^1.2.0",
|
||||
"webpack": "^3.11.0"
|
||||
"uglifyjs-webpack-plugin": "^1.3.0",
|
||||
"webpack": "^4.17.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="../webpack/discord.11.3.1.min.js"></script>
|
||||
<script type="text/javascript" src="../webpack/discord.11.4.2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
(() => {
|
||||
const client = window.client = new Discord.Client();
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
client.on('message', (message) => {
|
||||
console.log(message.author.username, message.author.id, message.content);
|
||||
console.log(message.guild.roles.find("name", "Sever Staff"));
|
||||
});
|
||||
|
||||
client.login(localStorage.token || window.token || prompt('token pls', 'abcdef123456'))
|
||||
|
||||
@@ -16,23 +16,15 @@ const createConfig = options => {
|
||||
'process.env': {
|
||||
__DISCORD_WEBPACK__: '"true"',
|
||||
},
|
||||
'process.emitWarning': (any, ...more) => console.warn(any, more),
|
||||
}),
|
||||
];
|
||||
|
||||
if (options.minify) {
|
||||
plugins.push(new UglifyJSPlugin({
|
||||
uglifyOptions: {
|
||||
mangle: { keep_classnames: true },
|
||||
compress: { keep_classnames: true },
|
||||
output: { comments: false },
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
const filename = `./webpack/discord${process.env.VERSIONED === 'false' ? '' : '.' + version}${options.minify ? '.min' : ''}.js`; // eslint-disable-line
|
||||
const filename = `./webpack/discord${process.env.VERSIONED === 'false' ? '' : '.' + version}${options.mode === 'production' ? '.min' : ''}.js`; // eslint-disable-line
|
||||
|
||||
return {
|
||||
entry: './browser.js',
|
||||
mode: options.mode,
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename,
|
||||
@@ -50,9 +42,21 @@ const createConfig = options => {
|
||||
dgram: 'empty',
|
||||
zlib: 'empty',
|
||||
__dirname: true,
|
||||
process: true,
|
||||
},
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new UglifyJSPlugin({
|
||||
uglifyOptions: {
|
||||
mangle: { keep_classnames: true },
|
||||
compress: { keep_classnames: true },
|
||||
output: { comments: false },
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = createVariants({}, { minify: [false, true] }, createConfig);
|
||||
module.exports = createVariants({}, { mode: ['development', 'production'] }, createConfig);
|
||||
|
||||
Reference in New Issue
Block a user