Files
discord.js/webpack.config.js
Gus Caplan 2440a4a2c8 Add webpack building (#907)
* friggin webpack tho

* probably important

* add all the stuff to the package.json

* add minify builds and a nice package.json script to run it all

* clean up

* use uglify harmony branch so we can actually run minify builds that work

* update build system

* make test better

* clean up

* fix issues with compression

* ‮

* c++ requirements in a node lib? whaaaaat?

* fix travis yml?

* put railings on voice connections

* 🖕🏻

* aaaaaa

* handle arraybuffers in the unlikely event one is sent

* support arraybuffers in resolvebuffer

* this needs to be fixed at some point

* this was fixed

* disable filename versioning if env VERSIONED is set to false

* Update ClientDataResolver.js

* Update ClientVoiceManager.js

* Update WebSocketManager.js

* Update ConvertArrayBuffer.js

* Update webpack.html

* enable compression for browser and fix ws error handler

* Update WebSocketManager.js

* everything will be okay gawdl3y

* compression is slower in browser, so rip the last three hours of my life

* Update Constants.js

* Update .gitignore
2016-11-20 19:38:16 -05:00

44 lines
1.1 KiB
JavaScript

/*
ONLY RUN BUILDS WITH `npm run web-dist`!
DO NOT USE NORMAL WEBPACK! IT WILL NOT WORK!
*/
const webpack = require('webpack');
const createVariants = require('parallel-webpack').createVariants;
const version = require('./package.json').version;
const createConfig = (options) => {
const plugins = [
new webpack.DefinePlugin({ 'global.GENTLY': false }),
];
if (options.minify) plugins.push(new webpack.optimize.UglifyJsPlugin({ minimize: true }));
const filename = `./webpack/discord${process.env.VERSIONED === 'false' ? '' : '.' + version}${options.minify ? '.min' : ''}.js`; // eslint-disable-line
return {
entry: './src/index.js',
output: {
path: __dirname,
filename,
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.md$/, loader: 'ignore-loader' },
],
},
node: {
fs: 'empty',
dns: 'mock',
tls: 'mock',
child_process: 'empty',
dgram: 'empty',
__dirname: true,
},
plugins,
};
};
module.exports = createVariants({}, { minify: [false, true] }, createConfig);