瀏覽代碼

Speed webpack up

master
Lyubo Marinov 7 年之前
父節點
當前提交
1da49d86a1
共有 2 個檔案被更改,包括 38 行新增46 行删除
  1. 32
    21
      app.js
  2. 6
    25
      webpack.config.js

+ 32
- 21
app.js 查看文件

@@ -15,28 +15,39 @@ import 'aui-experimental-css';
15 15
 
16 16
 window.toastr = require('toastr');
17 17
 
18
-export conference from './conference';
19
-export API from './modules/API';
20
-export keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
21
-export remoteControl from './modules/remotecontrol/RemoteControl';
22
-export settings from './modules/settings/Settings';
23
-export translation from './modules/translation/translation';
24
-export UI from './modules/UI/UI';
25
-
26
-// Used by do_external_connect.js if we receive the attach data after connect
27
-// was already executed. status property can be 'initialized', 'ready', or
28
-// 'connecting'. We are interested in 'ready' status only which means that
29
-// connect was executed but we have to wait for the attach data. In status
30
-// 'ready' handler property will be set to a function that will finish the
31
-// connect process when the attach data or error is received.
32
-export const connect = {
33
-    handler: null,
34
-    status: 'initialized'
35
-};
18
+import conference from './conference';
19
+import API from './modules/API';
20
+import keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut';
21
+import remoteControl from './modules/remotecontrol/RemoteControl';
22
+import settings from './modules/settings/Settings';
23
+import translation from './modules/translation/translation';
24
+import UI from './modules/UI/UI';
25
+
26
+window.APP = {
27
+    API,
28
+    conference,
29
+
30
+    // Used by do_external_connect.js if we receive the attach data after
31
+    // connect was already executed. status property can be 'initialized',
32
+    // 'ready', or 'connecting'. We are interested in 'ready' status only which
33
+    // means that connect was executed but we have to wait for the attach data.
34
+    // In status 'ready' handler property will be set to a function that will
35
+    // finish the connect process when the attach data or error is received.
36
+    connect: {
37
+        handler: null,
38
+        status: 'initialized'
39
+    },
40
+
41
+    // Used for automated performance tests.
42
+    connectionTimes: {
43
+        'index.loaded': window.indexLoadedTime
44
+    },
36 45
 
37
-// Used for automated performance tests
38
-export const connectionTimes = {
39
-    'index.loaded': window.indexLoadedTime
46
+    keyboardshortcut,
47
+    remoteControl,
48
+    settings,
49
+    translation,
50
+    UI
40 51
 };
41 52
 
42 53
 // TODO The execution of the mobile app starts from react/index.native.js.

+ 6
- 25
webpack.config.js 查看文件

@@ -147,7 +147,6 @@ const config = {
147 147
     },
148 148
     output: {
149 149
         filename: `[name]${minimize ? '.min' : ''}.js`,
150
-        libraryTarget: 'umd',
151 150
         path: `${__dirname}/build`,
152 151
         publicPath: '/libs/',
153 152
         sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
@@ -175,36 +174,19 @@ const config = {
175 174
     }
176 175
 };
177 176
 
178
-const configs = [
179
-
180
-    // The Webpack configuration to bundle app.bundle.js (aka APP).
177
+module.exports = [
181 178
     Object.assign({}, config, {
182 179
         entry: {
183 180
             'app.bundle': [
181
+
184 182
                 // XXX Required by at least IE11 at the time of this writing.
185 183
                 'babel-polyfill',
186 184
                 './app.js'
187
-            ]
188
-        },
189
-        output: Object.assign({}, config.output, {
190
-            library: 'APP'
191
-        })
192
-    }),
185
+            ],
193 186
 
194
-    // The Webpack configuration to bundle device_selection_popup_bundle.js
195
-    // (i.e. js file for the device selection popup dialog).
196
-    Object.assign({}, config, {
197
-        entry: {
198 187
             'device_selection_popup_bundle':
199
-                './react/features/device-selection/popup.js'
200
-        }
201
-    }),
188
+                './react/features/device-selection/popup.js',
202 189
 
203
-    // The Webpack configuration to bundle do_external_connect.js (which
204
-    // attempts to optimize Jitsi Meet's XMPP connection and, consequently, is
205
-    // also known as HTTP pre-bind).
206
-    Object.assign({}, config, {
207
-        entry: {
208 190
             'do_external_connect':
209 191
                 './connection_optimization/do_external_connect.js'
210 192
         }
@@ -217,13 +199,12 @@ const configs = [
217 199
             'external_api': './modules/API/external/index.js'
218 200
         },
219 201
         output: Object.assign({}, config.output, {
220
-            library: 'JitsiMeetExternalAPI'
202
+            library: 'JitsiMeetExternalAPI',
203
+            libraryTarget: 'umd'
221 204
         })
222 205
     })
223 206
 ];
224 207
 
225
-module.exports = configs;
226
-
227 208
 /**
228 209
  * Determines whether a specific (HTTP) request is to bypass the proxy of
229 210
  * webpack-dev-server (i.e. is to be handled by the proxy target) and, if not,

Loading…
取消
儲存