|
@@ -7,6 +7,14 @@ var process = require('process');
|
7
|
7
|
var webpack = require('webpack');
|
8
|
8
|
|
9
|
9
|
var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
|
|
10
|
+
|
|
11
|
+/**
|
|
12
|
+ * The URL of the Jitsi Meet deployment to be proxy to in the context of
|
|
13
|
+ * development with webpack-dev-server.
|
|
14
|
+ */
|
|
15
|
+var devServerProxyTarget
|
|
16
|
+ = process.env.WEBPACK_DEV_SERVER_PROXY_TARGET || 'https://beta.meet.jit.si';
|
|
17
|
+
|
10
|
18
|
var minimize
|
11
|
19
|
= process.argv.indexOf('-p') !== -1
|
12
|
20
|
|| process.argv.indexOf('--optimize-minimize') !== -1;
|
|
@@ -30,6 +38,17 @@ if (minimize) {
|
30
|
38
|
// The base Webpack configuration to bundle the JavaScript artifacts of
|
31
|
39
|
// jitsi-meet such as app.bundle.js and external_api.js.
|
32
|
40
|
var config = {
|
|
41
|
+ devServer: {
|
|
42
|
+ https: true,
|
|
43
|
+ inline: true,
|
|
44
|
+ proxy: {
|
|
45
|
+ '/': {
|
|
46
|
+ bypass: devServerProxyBypass,
|
|
47
|
+ secure: false,
|
|
48
|
+ target: devServerProxyTarget
|
|
49
|
+ }
|
|
50
|
+ }
|
|
51
|
+ },
|
33
|
52
|
devtool: 'source-map',
|
34
|
53
|
module: {
|
35
|
54
|
loaders: [ {
|
|
@@ -107,6 +126,7 @@ var config = {
|
107
|
126
|
filename: '[name]' + (minimize ? '.min' : '') + '.js',
|
108
|
127
|
libraryTarget: 'umd',
|
109
|
128
|
path: __dirname + '/build',
|
|
129
|
+ publicPath: '/libs/',
|
110
|
130
|
sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
|
111
|
131
|
},
|
112
|
132
|
plugins: plugins,
|
|
@@ -118,7 +138,7 @@ var config = {
|
118
|
138
|
}
|
119
|
139
|
};
|
120
|
140
|
|
121
|
|
-module.exports = [
|
|
141
|
+var configs = [
|
122
|
142
|
|
123
|
143
|
// The Webpack configuration to bundle app.bundle.js (aka APP).
|
124
|
144
|
Object.assign({}, config, {
|
|
@@ -141,3 +161,45 @@ module.exports = [
|
141
|
161
|
})
|
142
|
162
|
})
|
143
|
163
|
];
|
|
164
|
+
|
|
165
|
+module.exports = configs;
|
|
166
|
+
|
|
167
|
+/**
|
|
168
|
+ * Determines whether a specific (HTTP) request is to bypass the proxy of
|
|
169
|
+ * webpack-dev-server (i.e. is to be handled by the proxy target) and, if not,
|
|
170
|
+ * which local file is to be served in response to the request.
|
|
171
|
+ *
|
|
172
|
+ * @param {Object} request - The (HTTP) request received by the proxy.
|
|
173
|
+ * @returns {string|undefined} If the request is to be served by the proxy
|
|
174
|
+ * target, undefined; otherwise, the path to the local file to be served.
|
|
175
|
+ */
|
|
176
|
+function devServerProxyBypass(request) {
|
|
177
|
+ var path = request.path;
|
|
178
|
+
|
|
179
|
+ // Use local files from the css and libs directories.
|
|
180
|
+ if (path.startsWith('/css/')) {
|
|
181
|
+ return path;
|
|
182
|
+ }
|
|
183
|
+ if (configs.some(function (c) {
|
|
184
|
+ if (path.startsWith(c.output.publicPath)) {
|
|
185
|
+ if (!minimize) {
|
|
186
|
+ // Since webpack-dev-server is serving non-minimized
|
|
187
|
+ // artifacts, serve them even if the minimized ones are
|
|
188
|
+ // requested.
|
|
189
|
+ Object.keys(c.entry).some(function (e) {
|
|
190
|
+ var name = e + '.min.js';
|
|
191
|
+
|
|
192
|
+ if (path.indexOf(name) !== -1) {
|
|
193
|
+ path = path.replace(name, e + '.js');
|
|
194
|
+
|
|
195
|
+ return true;
|
|
196
|
+ }
|
|
197
|
+ });
|
|
198
|
+ }
|
|
199
|
+
|
|
200
|
+ return true;
|
|
201
|
+ }
|
|
202
|
+ })) {
|
|
203
|
+ return path;
|
|
204
|
+ }
|
|
205
|
+}
|