|
@@ -2,10 +2,31 @@
|
2
|
2
|
|
3
|
3
|
var child_process = require('child_process'); // eslint-disable-line camelcase
|
4
|
4
|
var process = require('process');
|
|
5
|
+var webpack = require('webpack');
|
5
|
6
|
|
6
|
7
|
var minimize
|
7
|
8
|
= process.argv.indexOf('-p') !== -1
|
8
|
9
|
|| process.argv.indexOf('--optimize-minimize') !== -1;
|
|
10
|
+var plugins = [];
|
|
11
|
+
|
|
12
|
+if (minimize) {
|
|
13
|
+ // While webpack will automatically insert UglifyJsPlugin when minimize is
|
|
14
|
+ // true, the defaults of UglifyJsPlugin in webpack 1 and webpack 2 are
|
|
15
|
+ // different. Explicitly state what we want even if we want defaults in
|
|
16
|
+ // order to prepare for webpack 2.
|
|
17
|
+ plugins.push(new webpack.optimize.UglifyJsPlugin({
|
|
18
|
+ compress: {
|
|
19
|
+ // It is nice to see warnings from UglifyJsPlugin that something is
|
|
20
|
+ // unused and, consequently, is removed. The default is false in
|
|
21
|
+ // webpack 2.
|
|
22
|
+ warnings: true
|
|
23
|
+ },
|
|
24
|
+
|
|
25
|
+ // Use the source map to map error message locations to modules. The
|
|
26
|
+ // default is false in webpack 2.
|
|
27
|
+ sourceMap: true
|
|
28
|
+ }));
|
|
29
|
+}
|
9
|
30
|
|
10
|
31
|
module.exports = {
|
11
|
32
|
devtool: 'source-map',
|
|
@@ -16,7 +37,7 @@ module.exports = {
|
16
|
37
|
loaders: [ {
|
17
|
38
|
// Version this build of the lib-jitsi-meet library.
|
18
|
39
|
|
19
|
|
- loader: 'string-replace',
|
|
40
|
+ loader: 'string-replace-loader',
|
20
|
41
|
query: {
|
21
|
42
|
flags: 'g',
|
22
|
43
|
replace:
|
|
@@ -40,7 +61,7 @@ module.exports = {
|
40
|
61
|
__dirname + '/modules/RTC/adapter.screenshare.js',
|
41
|
62
|
__dirname + '/node_modules/'
|
42
|
63
|
],
|
43
|
|
- loader: 'babel',
|
|
64
|
+ loader: 'babel-loader',
|
44
|
65
|
query: {
|
45
|
66
|
presets: [
|
46
|
67
|
'es2015'
|
|
@@ -60,5 +81,6 @@ module.exports = {
|
60
|
81
|
library: 'JitsiMeetJS',
|
61
|
82
|
libraryTarget: 'umd',
|
62
|
83
|
sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
|
63
|
|
- }
|
|
84
|
+ },
|
|
85
|
+ plugins: plugins
|
64
|
86
|
};
|