|
@@ -1,6 +1,5 @@
|
1
|
1
|
/* global __dirname */
|
2
|
2
|
|
3
|
|
-const HasteResolverPlugin = require('haste-resolver-webpack-plugin');
|
4
|
3
|
const process = require('process');
|
5
|
4
|
const webpack = require('webpack');
|
6
|
5
|
|
|
@@ -18,7 +17,10 @@ const minimize
|
18
|
17
|
|| process.argv.indexOf('--optimize-minimize') !== -1;
|
19
|
18
|
const node_modules = __dirname + '/node_modules/';
|
20
|
19
|
const plugins = [
|
21
|
|
- new HasteResolverPlugin()
|
|
20
|
+ new webpack.LoaderOptionsPlugin({
|
|
21
|
+ debug: !minimize,
|
|
22
|
+ minimize: minimize
|
|
23
|
+ })
|
22
|
24
|
];
|
23
|
25
|
const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
|
24
|
26
|
|
|
@@ -43,6 +45,7 @@ if (minimize) {
|
43
|
45
|
// webpack 2.
|
44
|
46
|
warnings: true
|
45
|
47
|
},
|
|
48
|
+ extractComments: true,
|
46
|
49
|
|
47
|
50
|
// Use the source map to map error message locations to modules. The
|
48
|
51
|
// default is false in webpack 2.
|
|
@@ -66,22 +69,28 @@ const config = {
|
66
|
69
|
},
|
67
|
70
|
devtool: 'source-map',
|
68
|
71
|
module: {
|
69
|
|
- loaders: [ {
|
|
72
|
+ rules: [ {
|
70
|
73
|
// Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
|
71
|
74
|
// as well.
|
72
|
75
|
|
73
|
76
|
exclude: node_modules,
|
74
|
77
|
loader: 'babel-loader',
|
75
|
|
- query: {
|
|
78
|
+ options: {
|
76
|
79
|
// XXX The require.resolve bellow solves failures to locate the
|
77
|
80
|
// presets when lib-jitsi-meet, for example, is npm linked in
|
78
|
81
|
// jitsi-meet. The require.resolve, of course, mandates the use
|
79
|
82
|
// of the prefix babel-preset- in the preset names.
|
80
|
83
|
presets: [
|
81
|
|
- 'babel-preset-es2015',
|
82
|
|
- 'babel-preset-react',
|
83
|
|
- 'babel-preset-stage-1'
|
84
|
|
- ].map(require.resolve)
|
|
84
|
+ [
|
|
85
|
+ require.resolve('babel-preset-es2015'),
|
|
86
|
+
|
|
87
|
+ // Tell babel to avoid compiling imports into CommonJS
|
|
88
|
+ // so that webpack may do tree shaking.
|
|
89
|
+ { modules: false }
|
|
90
|
+ ],
|
|
91
|
+ require.resolve('babel-preset-react'),
|
|
92
|
+ require.resolve('babel-preset-stage-1')
|
|
93
|
+ ]
|
85
|
94
|
},
|
86
|
95
|
test: /\.jsx?$/
|
87
|
96
|
}, {
|
|
@@ -105,28 +114,22 @@ const config = {
|
105
|
114
|
}, {
|
106
|
115
|
// Allow CSS to be imported into JavaScript.
|
107
|
116
|
|
108
|
|
- loaders: [
|
|
117
|
+ test: /\.css$/,
|
|
118
|
+ use: [
|
109
|
119
|
'style-loader',
|
110
|
120
|
'css-loader'
|
111
|
|
- ],
|
112
|
|
- test: /\.css$/
|
|
121
|
+ ]
|
113
|
122
|
}, {
|
114
|
123
|
// Emit the static assets of AUI such as images that are referenced
|
115
|
124
|
// by CSS into the output path.
|
116
|
125
|
|
117
|
126
|
include: aui_css,
|
118
|
127
|
loader: 'file-loader',
|
119
|
|
- query: {
|
|
128
|
+ options: {
|
120
|
129
|
context: aui_css,
|
121
|
130
|
name: '[path][name].[ext]'
|
122
|
131
|
},
|
123
|
132
|
test: /\.(gif|png|svg)$/
|
124
|
|
- }, {
|
125
|
|
- // Enable the import of JSON files.
|
126
|
|
-
|
127
|
|
- loader: 'json-loader',
|
128
|
|
- exclude: node_modules,
|
129
|
|
- test: /\.json$/
|
130
|
133
|
} ],
|
131
|
134
|
noParse: [
|
132
|
135
|
|
|
@@ -154,7 +157,20 @@ const config = {
|
154
|
157
|
alias: {
|
155
|
158
|
jquery: 'jquery/dist/jquery' + (minimize ? '.min' : '') + '.js'
|
156
|
159
|
},
|
157
|
|
- packageAlias: 'browser'
|
|
160
|
+ aliasFields: [
|
|
161
|
+ 'browser'
|
|
162
|
+ ],
|
|
163
|
+ extensions: [
|
|
164
|
+ // Webpack 2 broke haste-resolver-webpack-plugin and I could not fix
|
|
165
|
+ // it. But given that there is resolve.extensions and the only
|
|
166
|
+ // non-default extension we have is .web.js, drop
|
|
167
|
+ // haste-resolver-webpack-plugin and go with resolve.extensions.
|
|
168
|
+ '.web.js',
|
|
169
|
+
|
|
170
|
+ // Webpack defaults:
|
|
171
|
+ '.js',
|
|
172
|
+ '.json'
|
|
173
|
+ ]
|
158
|
174
|
}
|
159
|
175
|
};
|
160
|
176
|
|
|
@@ -164,7 +180,7 @@ const configs = [
|
164
|
180
|
Object.assign({}, config, {
|
165
|
181
|
entry: {
|
166
|
182
|
'app.bundle': [
|
167
|
|
- // XXX Requried by at least IE11 at the time of this writing.
|
|
183
|
+ // XXX Required by at least IE11 at the time of this writing.
|
168
|
184
|
'babel-polyfill',
|
169
|
185
|
'./app.js'
|
170
|
186
|
]
|
|
@@ -174,6 +190,15 @@ const configs = [
|
174
|
190
|
})
|
175
|
191
|
}),
|
176
|
192
|
|
|
193
|
+ // The Webpack configuration to bundle device_selection_popup_bundle.js
|
|
194
|
+ // (i.e. js file for the device selection popup dialog).
|
|
195
|
+ Object.assign({}, config, {
|
|
196
|
+ entry: {
|
|
197
|
+ 'device_selection_popup_bundle':
|
|
198
|
+ './react/features/device-selection/popup.js'
|
|
199
|
+ }
|
|
200
|
+ }),
|
|
201
|
+
|
177
|
202
|
// The Webpack configuration to bundle do_external_connect.js (which
|
178
|
203
|
// attempts to optimize Jitsi Meet's XMPP connection and, consequently, is
|
179
|
204
|
// also known as HTTP pre-bind).
|
|
@@ -193,16 +218,6 @@ const configs = [
|
193
|
218
|
output: Object.assign({}, config.output, {
|
194
|
219
|
library: 'JitsiMeetExternalAPI'
|
195
|
220
|
})
|
196
|
|
- }),
|
197
|
|
-
|
198
|
|
- // The Webpack configuration to bundle popup_bundle.js (js file for the
|
199
|
|
- // device selection popup dialog).
|
200
|
|
- Object.assign({}, config, {
|
201
|
|
- entry: {
|
202
|
|
- 'device_selection_popup_bundle':
|
203
|
|
- './react/features/device-selection/popup.js'
|
204
|
|
- },
|
205
|
|
- output: config.output
|
206
|
221
|
})
|
207
|
222
|
];
|
208
|
223
|
|