|
@@ -1,6 +1,8 @@
|
1
|
1
|
/* global __dirname */
|
2
|
2
|
|
3
|
3
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
4
|
+const fs = require('fs');
|
|
5
|
+const { join } = require('path');
|
4
|
6
|
const process = require('process');
|
5
|
7
|
const webpack = require('webpack');
|
6
|
8
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
@@ -12,18 +14,19 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
12
|
14
|
const devServerProxyTarget
|
13
|
15
|
= process.env.WEBPACK_DEV_SERVER_PROXY_TARGET || 'https://alpha.jitsi.net';
|
14
|
16
|
|
15
|
|
-const analyzeBundle = process.argv.indexOf('--analyze-bundle') !== -1;
|
16
|
|
-const detectCircularDeps = process.argv.indexOf('--detect-circular-deps') !== -1;
|
17
|
|
-
|
18
|
|
-const minimize
|
19
|
|
- = process.argv.indexOf('-p') !== -1
|
20
|
|
- || process.argv.indexOf('--optimize-minimize') !== -1;
|
21
|
|
-
|
22
|
17
|
/**
|
23
|
18
|
* Build a Performance configuration object for the given size.
|
24
|
19
|
* See: https://webpack.js.org/configuration/performance/
|
|
20
|
+ *
|
|
21
|
+ * @param {Object} options - options for the bundles configuration.
|
|
22
|
+ * @param {boolean} options.analyzeBundle - whether the bundle needs to be analyzed for size.
|
|
23
|
+ * @param {boolean} options.minimize - whether the code should be minimized or not.
|
|
24
|
+ * @param {number} size - the size limit to apply.
|
|
25
|
+ * @returns {Object} a performance hints object.
|
25
|
26
|
*/
|
26
|
|
-function getPerformanceHints(size) {
|
|
27
|
+function getPerformanceHints(options, size) {
|
|
28
|
+ const { analyzeBundle, minimize } = options;
|
|
29
|
+
|
27
|
30
|
return {
|
28
|
31
|
hints: minimize && !analyzeBundle ? 'error' : false,
|
29
|
32
|
maxAssetSize: size,
|
|
@@ -33,8 +36,12 @@ function getPerformanceHints(size) {
|
33
|
36
|
|
34
|
37
|
/**
|
35
|
38
|
* Build a BundleAnalyzerPlugin plugin instance for the given bundle name.
|
|
39
|
+ *
|
|
40
|
+ * @param {boolean} analyzeBundle - whether the bundle needs to be analyzed for size.
|
|
41
|
+ * @param {string} name - the name of the bundle.
|
|
42
|
+ * @returns {Array} a configured list of plugins.
|
36
|
43
|
*/
|
37
|
|
-function getBundleAnalyzerPlugin(name) {
|
|
44
|
+function getBundleAnalyzerPlugin(analyzeBundle, name) {
|
38
|
45
|
if (!analyzeBundle) {
|
39
|
46
|
return [];
|
40
|
47
|
}
|
|
@@ -46,251 +53,6 @@ function getBundleAnalyzerPlugin(name) {
|
46
|
53
|
}) ];
|
47
|
54
|
}
|
48
|
55
|
|
49
|
|
-
|
50
|
|
-// The base Webpack configuration to bundle the JavaScript artifacts of
|
51
|
|
-// jitsi-meet such as app.bundle.js and external_api.js.
|
52
|
|
-const config = {
|
53
|
|
- devServer: {
|
54
|
|
- https: true,
|
55
|
|
- host: '127.0.0.1',
|
56
|
|
- inline: true,
|
57
|
|
- proxy: {
|
58
|
|
- '/': {
|
59
|
|
- bypass: devServerProxyBypass,
|
60
|
|
- secure: false,
|
61
|
|
- target: devServerProxyTarget,
|
62
|
|
- headers: {
|
63
|
|
- 'Host': new URL(devServerProxyTarget).host
|
64
|
|
- }
|
65
|
|
- }
|
66
|
|
- }
|
67
|
|
- },
|
68
|
|
- devtool: 'source-map',
|
69
|
|
- mode: minimize ? 'production' : 'development',
|
70
|
|
- module: {
|
71
|
|
- rules: [ {
|
72
|
|
- // Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
|
73
|
|
- // as well.
|
74
|
|
-
|
75
|
|
- loader: 'babel-loader',
|
76
|
|
- options: {
|
77
|
|
- // Avoid loading babel.config.js, since we only use it for React Native.
|
78
|
|
- configFile: false,
|
79
|
|
-
|
80
|
|
- // XXX The require.resolve bellow solves failures to locate the
|
81
|
|
- // presets when lib-jitsi-meet, for example, is npm linked in
|
82
|
|
- // jitsi-meet.
|
83
|
|
- plugins: [
|
84
|
|
- require.resolve('@babel/plugin-transform-flow-strip-types'),
|
85
|
|
- require.resolve('@babel/plugin-proposal-class-properties'),
|
86
|
|
- require.resolve('@babel/plugin-proposal-export-default-from'),
|
87
|
|
- require.resolve('@babel/plugin-proposal-export-namespace-from'),
|
88
|
|
- require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
|
89
|
|
- require.resolve('@babel/plugin-proposal-optional-chaining')
|
90
|
|
- ],
|
91
|
|
- presets: [
|
92
|
|
- [
|
93
|
|
- require.resolve('@babel/preset-env'),
|
94
|
|
-
|
95
|
|
- // Tell babel to avoid compiling imports into CommonJS
|
96
|
|
- // so that webpack may do tree shaking.
|
97
|
|
- {
|
98
|
|
- modules: false,
|
99
|
|
-
|
100
|
|
- // Specify our target browsers so no transpiling is
|
101
|
|
- // done unnecessarily. For browsers not specified
|
102
|
|
- // here, the ES2015+ profile will be used.
|
103
|
|
- targets: {
|
104
|
|
- chrome: 58,
|
105
|
|
- electron: 2,
|
106
|
|
- firefox: 54,
|
107
|
|
- safari: 11
|
108
|
|
- }
|
109
|
|
-
|
110
|
|
- }
|
111
|
|
- ],
|
112
|
|
- require.resolve('@babel/preset-flow'),
|
113
|
|
- require.resolve('@babel/preset-react')
|
114
|
|
- ]
|
115
|
|
- },
|
116
|
|
- test: /\.jsx?$/
|
117
|
|
- }, {
|
118
|
|
- // Expose jquery as the globals $ and jQuery because it is expected
|
119
|
|
- // to be available in such a form by multiple jitsi-meet
|
120
|
|
- // dependencies including lib-jitsi-meet.
|
121
|
|
-
|
122
|
|
- loader: 'expose-loader?$!expose-loader?jQuery',
|
123
|
|
- test: /[/\\]node_modules[/\\]jquery[/\\].*\.js$/
|
124
|
|
- }, {
|
125
|
|
- // Allow CSS to be imported into JavaScript.
|
126
|
|
-
|
127
|
|
- test: /\.css$/,
|
128
|
|
- use: [
|
129
|
|
- 'style-loader',
|
130
|
|
- 'css-loader'
|
131
|
|
- ]
|
132
|
|
- }, {
|
133
|
|
- test: /\/node_modules\/@atlaskit\/modal-dialog\/.*\.js$/,
|
134
|
|
- resolve: {
|
135
|
|
- alias: {
|
136
|
|
- 'react-focus-lock': `${__dirname}/react/features/base/util/react-focus-lock-wrapper.js`,
|
137
|
|
- '../styled/Modal': `${__dirname}/react/features/base/dialog/components/web/ThemedDialog.js`
|
138
|
|
- }
|
139
|
|
- }
|
140
|
|
- }, {
|
141
|
|
- test: /\/react\/features\/base\/util\/react-focus-lock-wrapper.js$/,
|
142
|
|
- resolve: {
|
143
|
|
- alias: {
|
144
|
|
- 'react-focus-lock': `${__dirname}/node_modules/react-focus-lock`
|
145
|
|
- }
|
146
|
|
- }
|
147
|
|
- }, {
|
148
|
|
- test: /\.svg$/,
|
149
|
|
- use: [ {
|
150
|
|
- loader: '@svgr/webpack',
|
151
|
|
- options: {
|
152
|
|
- dimensions: false,
|
153
|
|
- expandProps: 'start'
|
154
|
|
- }
|
155
|
|
- } ]
|
156
|
|
- } ]
|
157
|
|
- },
|
158
|
|
- node: {
|
159
|
|
- // Allow the use of the real filename of the module being executed. By
|
160
|
|
- // default Webpack does not leak path-related information and provides a
|
161
|
|
- // value that is a mock (/index.js).
|
162
|
|
- __filename: true,
|
163
|
|
-
|
164
|
|
- // Provide some empty Node modules (required by olm).
|
165
|
|
- crypto: 'empty',
|
166
|
|
- fs: 'empty'
|
167
|
|
- },
|
168
|
|
- optimization: {
|
169
|
|
- concatenateModules: minimize,
|
170
|
|
- minimize
|
171
|
|
- },
|
172
|
|
- output: {
|
173
|
|
- filename: `[name]${minimize ? '.min' : ''}.js`,
|
174
|
|
- path: `${__dirname}/build`,
|
175
|
|
- publicPath: '/libs/',
|
176
|
|
- sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
|
177
|
|
- },
|
178
|
|
- plugins: [
|
179
|
|
- detectCircularDeps
|
180
|
|
- && new CircularDependencyPlugin({
|
181
|
|
- allowAsyncCycles: false,
|
182
|
|
- exclude: /node_modules/,
|
183
|
|
- failOnError: false
|
184
|
|
- })
|
185
|
|
- ].filter(Boolean),
|
186
|
|
- resolve: {
|
187
|
|
- alias: {
|
188
|
|
- 'focus-visible': 'focus-visible/dist/focus-visible.min.js',
|
189
|
|
- jquery: `jquery/dist/jquery${minimize ? '.min' : ''}.js`
|
190
|
|
- },
|
191
|
|
- aliasFields: [
|
192
|
|
- 'browser'
|
193
|
|
- ],
|
194
|
|
- extensions: [
|
195
|
|
- '.web.js',
|
196
|
|
-
|
197
|
|
- // Webpack defaults:
|
198
|
|
- '.js',
|
199
|
|
- '.json'
|
200
|
|
- ]
|
201
|
|
- }
|
202
|
|
-};
|
203
|
|
-
|
204
|
|
-module.exports = [
|
205
|
|
- Object.assign({}, config, {
|
206
|
|
- entry: {
|
207
|
|
- 'app.bundle': './app.js'
|
208
|
|
- },
|
209
|
|
- plugins: [
|
210
|
|
- ...config.plugins,
|
211
|
|
- ...getBundleAnalyzerPlugin('app'),
|
212
|
|
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
|
213
|
|
- ],
|
214
|
|
- performance: getPerformanceHints(4 * 1024 * 1024)
|
215
|
|
- }),
|
216
|
|
- Object.assign({}, config, {
|
217
|
|
- entry: {
|
218
|
|
- 'alwaysontop': './react/features/always-on-top/index.js'
|
219
|
|
- },
|
220
|
|
- plugins: [
|
221
|
|
- ...config.plugins,
|
222
|
|
- ...getBundleAnalyzerPlugin('alwaysontop')
|
223
|
|
- ],
|
224
|
|
- performance: getPerformanceHints(800 * 1024)
|
225
|
|
- }),
|
226
|
|
- Object.assign({}, config, {
|
227
|
|
- entry: {
|
228
|
|
- 'dial_in_info_bundle': './react/features/invite/components/dial-in-info-page'
|
229
|
|
- },
|
230
|
|
- plugins: [
|
231
|
|
- ...config.plugins,
|
232
|
|
- ...getBundleAnalyzerPlugin('dial_in_info'),
|
233
|
|
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
|
234
|
|
- ],
|
235
|
|
- performance: getPerformanceHints(500 * 1024)
|
236
|
|
- }),
|
237
|
|
- Object.assign({}, config, {
|
238
|
|
- entry: {
|
239
|
|
- 'do_external_connect': './connection_optimization/do_external_connect.js'
|
240
|
|
- },
|
241
|
|
- plugins: [
|
242
|
|
- ...config.plugins,
|
243
|
|
- ...getBundleAnalyzerPlugin('do_external_connect')
|
244
|
|
- ],
|
245
|
|
- performance: getPerformanceHints(5 * 1024)
|
246
|
|
- }),
|
247
|
|
- Object.assign({}, config, {
|
248
|
|
- entry: {
|
249
|
|
- 'flacEncodeWorker': './react/features/local-recording/recording/flac/flacEncodeWorker.js'
|
250
|
|
- },
|
251
|
|
- plugins: [
|
252
|
|
- ...config.plugins,
|
253
|
|
- ...getBundleAnalyzerPlugin('flacEncodeWorker')
|
254
|
|
- ],
|
255
|
|
- performance: getPerformanceHints(5 * 1024)
|
256
|
|
- }),
|
257
|
|
- Object.assign({}, config, {
|
258
|
|
- entry: {
|
259
|
|
- 'analytics-ga': './react/features/analytics/handlers/GoogleAnalyticsHandler.js'
|
260
|
|
- },
|
261
|
|
- plugins: [
|
262
|
|
- ...config.plugins,
|
263
|
|
- ...getBundleAnalyzerPlugin('analytics-ga')
|
264
|
|
- ],
|
265
|
|
- performance: getPerformanceHints(5 * 1024)
|
266
|
|
- }),
|
267
|
|
- Object.assign({}, config, {
|
268
|
|
- entry: {
|
269
|
|
- 'close3': './static/close3.js'
|
270
|
|
- },
|
271
|
|
- plugins: [
|
272
|
|
- ...config.plugins,
|
273
|
|
- ...getBundleAnalyzerPlugin('close3')
|
274
|
|
- ],
|
275
|
|
- performance: getPerformanceHints(128 * 1024)
|
276
|
|
- }),
|
277
|
|
-
|
278
|
|
- Object.assign({}, config, {
|
279
|
|
- entry: {
|
280
|
|
- 'external_api': './modules/API/external/index.js'
|
281
|
|
- },
|
282
|
|
- output: Object.assign({}, config.output, {
|
283
|
|
- library: 'JitsiMeetExternalAPI',
|
284
|
|
- libraryTarget: 'umd'
|
285
|
|
- }),
|
286
|
|
- plugins: [
|
287
|
|
- ...config.plugins,
|
288
|
|
- ...getBundleAnalyzerPlugin('external_api')
|
289
|
|
- ],
|
290
|
|
- performance: getPerformanceHints(35 * 1024)
|
291
|
|
- })
|
292
|
|
-];
|
293
|
|
-
|
294
|
56
|
/**
|
295
|
57
|
* Determines whether a specific (HTTP) request is to bypass the proxy of
|
296
|
58
|
* webpack-dev-server (i.e. is to be handled by the proxy target) and, if not,
|
|
@@ -301,7 +63,8 @@ module.exports = [
|
301
|
63
|
* target, undefined; otherwise, the path to the local file to be served.
|
302
|
64
|
*/
|
303
|
65
|
function devServerProxyBypass({ path }) {
|
304
|
|
- if (path.startsWith('/css/') || path.startsWith('/doc/')
|
|
66
|
+ if (path.startsWith('/css/')
|
|
67
|
+ || path.startsWith('/doc/')
|
305
|
68
|
|| path.startsWith('/fonts/')
|
306
|
69
|
|| path.startsWith('/images/')
|
307
|
70
|
|| path.startsWith('/lang/')
|
|
@@ -312,33 +75,307 @@ function devServerProxyBypass({ path }) {
|
312
|
75
|
return path;
|
313
|
76
|
}
|
314
|
77
|
|
315
|
|
- const configs = module.exports;
|
|
78
|
+ if (path.startsWith('/libs/')) {
|
|
79
|
+ if (path.endsWith('.min.js') && !fs.existsSync(join(process.cwd(), path))) {
|
|
80
|
+ return path.replace('.min.js', '.js');
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ return path;
|
|
84
|
+ }
|
|
85
|
+}
|
|
86
|
+
|
|
87
|
+/**
|
|
88
|
+ * The base Webpack configuration to bundle the JavaScript artifacts of
|
|
89
|
+ * jitsi-meet such as app.bundle.js and external_api.js.
|
|
90
|
+ *
|
|
91
|
+ * @param {Object} options - options for the bundles configuration.
|
|
92
|
+ * @param {boolean} options.detectCircularDeps - whether to detect circular dependencies or not.
|
|
93
|
+ * @param {boolean} options.minimize - whether the code should be minimized or not.
|
|
94
|
+ * @returns {Object} the base config object.
|
|
95
|
+ */
|
|
96
|
+function getConfig(options = {}) {
|
|
97
|
+ const { detectCircularDeps, minimize } = options;
|
|
98
|
+
|
|
99
|
+ return {
|
|
100
|
+ devtool: 'source-map',
|
|
101
|
+ mode: minimize ? 'production' : 'development',
|
|
102
|
+ module: {
|
|
103
|
+ rules: [ {
|
|
104
|
+ // Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
|
|
105
|
+ // as well.
|
316
|
106
|
|
317
|
|
- /* eslint-disable array-callback-return, indent */
|
|
107
|
+ loader: 'babel-loader',
|
|
108
|
+ options: {
|
|
109
|
+ // Avoid loading babel.config.js, since we only use it for React Native.
|
|
110
|
+ configFile: false,
|
318
|
111
|
|
319
|
|
- if ((Array.isArray(configs) ? configs : Array(configs)).some(c => {
|
320
|
|
- if (path.startsWith(c.output.publicPath)) {
|
321
|
|
- if (!minimize) {
|
322
|
|
- // Since webpack-dev-server is serving non-minimized
|
323
|
|
- // artifacts, serve them even if the minimized ones are
|
324
|
|
- // requested.
|
325
|
|
- return Object.keys(c.entry).some(e => {
|
326
|
|
- const name = `${e}.min.js`;
|
|
112
|
+ // XXX The require.resolve bellow solves failures to locate the
|
|
113
|
+ // presets when lib-jitsi-meet, for example, is npm linked in
|
|
114
|
+ // jitsi-meet.
|
|
115
|
+ plugins: [
|
|
116
|
+ require.resolve('@babel/plugin-transform-flow-strip-types'),
|
|
117
|
+ require.resolve('@babel/plugin-proposal-class-properties'),
|
|
118
|
+ require.resolve('@babel/plugin-proposal-export-default-from'),
|
|
119
|
+ require.resolve('@babel/plugin-proposal-export-namespace-from'),
|
|
120
|
+ require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
|
|
121
|
+ require.resolve('@babel/plugin-proposal-optional-chaining')
|
|
122
|
+ ],
|
|
123
|
+ presets: [
|
|
124
|
+ [
|
|
125
|
+ require.resolve('@babel/preset-env'),
|
|
126
|
+
|
|
127
|
+ // Tell babel to avoid compiling imports into CommonJS
|
|
128
|
+ // so that webpack may do tree shaking.
|
|
129
|
+ {
|
|
130
|
+ modules: false,
|
327
|
131
|
|
328
|
|
- if (path.indexOf(name) !== -1) {
|
329
|
|
- // eslint-disable-next-line no-param-reassign
|
330
|
|
- path = path.replace(name, `${e}.js`);
|
|
132
|
+ // Specify our target browsers so no transpiling is
|
|
133
|
+ // done unnecessarily. For browsers not specified
|
|
134
|
+ // here, the ES2015+ profile will be used.
|
|
135
|
+ targets: {
|
|
136
|
+ chrome: 58,
|
|
137
|
+ electron: 2,
|
|
138
|
+ firefox: 54,
|
|
139
|
+ safari: 11
|
|
140
|
+ }
|
331
|
141
|
|
332
|
|
- return true;
|
333
|
142
|
}
|
334
|
|
- });
|
|
143
|
+ ],
|
|
144
|
+ require.resolve('@babel/preset-flow'),
|
|
145
|
+ require.resolve('@babel/preset-react')
|
|
146
|
+ ]
|
|
147
|
+ },
|
|
148
|
+ test: /\.jsx?$/
|
|
149
|
+ }, {
|
|
150
|
+ // TODO: get rid of this.
|
|
151
|
+ // Expose jquery as the globals $ and jQuery because it is expected
|
|
152
|
+ // to be available in such a form by lib-jitsi-meet.
|
|
153
|
+ loader: 'expose-loader',
|
|
154
|
+ options: {
|
|
155
|
+ exposes: [ '$', 'jQuery' ]
|
|
156
|
+ },
|
|
157
|
+ test: require.resolve('jquery')
|
|
158
|
+ }, {
|
|
159
|
+ // Allow CSS to be imported into JavaScript.
|
|
160
|
+
|
|
161
|
+ test: /\.css$/,
|
|
162
|
+ use: [
|
|
163
|
+ 'style-loader',
|
|
164
|
+ 'css-loader'
|
|
165
|
+ ]
|
|
166
|
+ }, {
|
|
167
|
+ test: /\/node_modules\/@atlaskit\/modal-dialog\/.*\.js$/,
|
|
168
|
+ resolve: {
|
|
169
|
+ alias: {
|
|
170
|
+ 'react-focus-lock': `${__dirname}/react/features/base/util/react-focus-lock-wrapper.js`,
|
|
171
|
+ '../styled/Modal': `${__dirname}/react/features/base/dialog/components/web/ThemedDialog.js`
|
335
|
172
|
}
|
336
|
173
|
}
|
337
|
|
- })) {
|
338
|
|
- return path;
|
339
|
|
- }
|
|
174
|
+ }, {
|
|
175
|
+ test: /\/react\/features\/base\/util\/react-focus-lock-wrapper.js$/,
|
|
176
|
+ resolve: {
|
|
177
|
+ alias: {
|
|
178
|
+ 'react-focus-lock': `${__dirname}/node_modules/react-focus-lock`
|
|
179
|
+ }
|
|
180
|
+ }
|
|
181
|
+ }, {
|
|
182
|
+ test: /\.svg$/,
|
|
183
|
+ use: [ {
|
|
184
|
+ loader: '@svgr/webpack',
|
|
185
|
+ options: {
|
|
186
|
+ dimensions: false,
|
|
187
|
+ expandProps: 'start'
|
|
188
|
+ }
|
|
189
|
+ } ]
|
|
190
|
+ } ]
|
|
191
|
+ },
|
|
192
|
+ node: {
|
|
193
|
+ // Allow the use of the real filename of the module being executed. By
|
|
194
|
+ // default Webpack does not leak path-related information and provides a
|
|
195
|
+ // value that is a mock (/index.js).
|
|
196
|
+ __filename: true
|
|
197
|
+ },
|
|
198
|
+ optimization: {
|
|
199
|
+ concatenateModules: minimize,
|
|
200
|
+ minimize
|
|
201
|
+ },
|
|
202
|
+ output: {
|
|
203
|
+ filename: `[name]${minimize ? '.min' : ''}.js`,
|
|
204
|
+ path: `${__dirname}/build`,
|
|
205
|
+ publicPath: '/libs/',
|
|
206
|
+ sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
|
|
207
|
+ },
|
|
208
|
+ plugins: [
|
|
209
|
+ detectCircularDeps
|
|
210
|
+ && new CircularDependencyPlugin({
|
|
211
|
+ allowAsyncCycles: false,
|
|
212
|
+ exclude: /node_modules/,
|
|
213
|
+ failOnError: false
|
|
214
|
+ })
|
|
215
|
+ ].filter(Boolean),
|
|
216
|
+ resolve: {
|
|
217
|
+ alias: {
|
|
218
|
+ 'focus-visible': 'focus-visible/dist/focus-visible.min.js'
|
|
219
|
+ },
|
|
220
|
+ aliasFields: [
|
|
221
|
+ 'browser'
|
|
222
|
+ ],
|
|
223
|
+ extensions: [
|
|
224
|
+ '.web.js',
|
340
|
225
|
|
341
|
|
- if (path.startsWith('/libs/')) {
|
342
|
|
- return path;
|
343
|
|
- }
|
|
226
|
+ // Webpack defaults:
|
|
227
|
+ '.js',
|
|
228
|
+ '.json'
|
|
229
|
+ ],
|
|
230
|
+ fallback: {
|
|
231
|
+ // Provide some empty Node modules (required by AtlasKit, olm).
|
|
232
|
+ crypto: false,
|
|
233
|
+ fs: false,
|
|
234
|
+ path: false,
|
|
235
|
+ process: false
|
|
236
|
+ }
|
|
237
|
+ }
|
|
238
|
+ };
|
344
|
239
|
}
|
|
240
|
+
|
|
241
|
+/**
|
|
242
|
+ * Helper function to build the dev server config. It's necessary to split it in
|
|
243
|
+ * Webpack 5 because only one devServer entry is supported, so we attach it to
|
|
244
|
+ * the main bundle.
|
|
245
|
+ *
|
|
246
|
+ * @returns {Object} the dev server configuration.
|
|
247
|
+ */
|
|
248
|
+function getDevServerConfig() {
|
|
249
|
+ return {
|
|
250
|
+ https: true,
|
|
251
|
+ host: '127.0.0.1',
|
|
252
|
+ proxy: {
|
|
253
|
+ '/': {
|
|
254
|
+ bypass: devServerProxyBypass,
|
|
255
|
+ secure: false,
|
|
256
|
+ target: devServerProxyTarget,
|
|
257
|
+ headers: {
|
|
258
|
+ 'Host': new URL(devServerProxyTarget).host
|
|
259
|
+ }
|
|
260
|
+ }
|
|
261
|
+ },
|
|
262
|
+ static: {
|
|
263
|
+ directory: process.cwd()
|
|
264
|
+ }
|
|
265
|
+ };
|
|
266
|
+}
|
|
267
|
+
|
|
268
|
+module.exports = (_env, argv) => {
|
|
269
|
+ const analyzeBundle = Boolean(process.env.ANALYZE_BUNDLE);
|
|
270
|
+ const mode = typeof argv.mode === 'undefined' ? 'production' : argv.mode;
|
|
271
|
+ const isProduction = mode === 'production';
|
|
272
|
+ const configOptions = {
|
|
273
|
+ detectCircularDeps: Boolean(process.env.DETECT_CIRCULAR_DEPS) || !isProduction,
|
|
274
|
+ minimize: isProduction
|
|
275
|
+ };
|
|
276
|
+ const config = getConfig(configOptions);
|
|
277
|
+ const perfHintOptions = {
|
|
278
|
+ analyzeBundle,
|
|
279
|
+ minimize: isProduction
|
|
280
|
+ };
|
|
281
|
+
|
|
282
|
+ return [
|
|
283
|
+ Object.assign({}, config, {
|
|
284
|
+ entry: {
|
|
285
|
+ 'app.bundle': './app.js'
|
|
286
|
+ },
|
|
287
|
+ devServer: isProduction ? {} : getDevServerConfig(),
|
|
288
|
+ plugins: [
|
|
289
|
+ ...config.plugins,
|
|
290
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'app'),
|
|
291
|
+ new webpack.IgnorePlugin({
|
|
292
|
+ resourceRegExp: /^\.\/locale$/,
|
|
293
|
+ contextRegExp: /moment$/
|
|
294
|
+ }),
|
|
295
|
+ new webpack.ProvidePlugin({
|
|
296
|
+ process: 'process/browser'
|
|
297
|
+ })
|
|
298
|
+ ],
|
|
299
|
+ performance: getPerformanceHints(perfHintOptions, 4 * 1024 * 1024)
|
|
300
|
+ }),
|
|
301
|
+ Object.assign({}, config, {
|
|
302
|
+ entry: {
|
|
303
|
+ 'alwaysontop': './react/features/always-on-top/index.js'
|
|
304
|
+ },
|
|
305
|
+ plugins: [
|
|
306
|
+ ...config.plugins,
|
|
307
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'alwaysontop')
|
|
308
|
+ ],
|
|
309
|
+ performance: getPerformanceHints(perfHintOptions, 800 * 1024)
|
|
310
|
+ }),
|
|
311
|
+ Object.assign({}, config, {
|
|
312
|
+ entry: {
|
|
313
|
+ 'dial_in_info_bundle': './react/features/invite/components/dial-in-info-page'
|
|
314
|
+ },
|
|
315
|
+ plugins: [
|
|
316
|
+ ...config.plugins,
|
|
317
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'dial_in_info'),
|
|
318
|
+ new webpack.IgnorePlugin({
|
|
319
|
+ resourceRegExp: /^\.\/locale$/,
|
|
320
|
+ contextRegExp: /moment$/
|
|
321
|
+ })
|
|
322
|
+ ],
|
|
323
|
+ performance: getPerformanceHints(perfHintOptions, 500 * 1024)
|
|
324
|
+ }),
|
|
325
|
+ Object.assign({}, config, {
|
|
326
|
+ entry: {
|
|
327
|
+ 'do_external_connect': './connection_optimization/do_external_connect.js'
|
|
328
|
+ },
|
|
329
|
+ plugins: [
|
|
330
|
+ ...config.plugins,
|
|
331
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'do_external_connect')
|
|
332
|
+ ],
|
|
333
|
+ performance: getPerformanceHints(perfHintOptions, 5 * 1024)
|
|
334
|
+ }),
|
|
335
|
+ Object.assign({}, config, {
|
|
336
|
+ entry: {
|
|
337
|
+ 'flacEncodeWorker': './react/features/local-recording/recording/flac/flacEncodeWorker.js'
|
|
338
|
+ },
|
|
339
|
+ plugins: [
|
|
340
|
+ ...config.plugins,
|
|
341
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'flacEncodeWorker')
|
|
342
|
+ ],
|
|
343
|
+ performance: getPerformanceHints(perfHintOptions, 5 * 1024)
|
|
344
|
+ }),
|
|
345
|
+ Object.assign({}, config, {
|
|
346
|
+ entry: {
|
|
347
|
+ 'analytics-ga': './react/features/analytics/handlers/GoogleAnalyticsHandler.js'
|
|
348
|
+ },
|
|
349
|
+ plugins: [
|
|
350
|
+ ...config.plugins,
|
|
351
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'analytics-ga')
|
|
352
|
+ ],
|
|
353
|
+ performance: getPerformanceHints(perfHintOptions, 5 * 1024)
|
|
354
|
+ }),
|
|
355
|
+ Object.assign({}, config, {
|
|
356
|
+ entry: {
|
|
357
|
+ 'close3': './static/close3.js'
|
|
358
|
+ },
|
|
359
|
+ plugins: [
|
|
360
|
+ ...config.plugins,
|
|
361
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'close3')
|
|
362
|
+ ],
|
|
363
|
+ performance: getPerformanceHints(perfHintOptions, 128 * 1024)
|
|
364
|
+ }),
|
|
365
|
+
|
|
366
|
+ Object.assign({}, config, {
|
|
367
|
+ entry: {
|
|
368
|
+ 'external_api': './modules/API/external/index.js'
|
|
369
|
+ },
|
|
370
|
+ output: Object.assign({}, config.output, {
|
|
371
|
+ library: 'JitsiMeetExternalAPI',
|
|
372
|
+ libraryTarget: 'umd'
|
|
373
|
+ }),
|
|
374
|
+ plugins: [
|
|
375
|
+ ...config.plugins,
|
|
376
|
+ ...getBundleAnalyzerPlugin(analyzeBundle, 'external_api')
|
|
377
|
+ ],
|
|
378
|
+ performance: getPerformanceHints(perfHintOptions, 35 * 1024)
|
|
379
|
+ })
|
|
380
|
+ ];
|
|
381
|
+};
|