From 1da49d86a16a174751d523ad1bde422bd477a61e Mon Sep 17 00:00:00 2001 From: Lyubo Marinov Date: Thu, 15 Jun 2017 22:47:04 -0500 Subject: [PATCH] Speed webpack up --- app.js | 51 ++++++++++++++++++++++++++++------------------- webpack.config.js | 31 ++++++---------------------- 2 files changed, 37 insertions(+), 45 deletions(-) diff --git a/app.js b/app.js index 091d40d5d..1d2124a2c 100644 --- a/app.js +++ b/app.js @@ -15,28 +15,39 @@ import 'aui-experimental-css'; window.toastr = require('toastr'); -export conference from './conference'; -export API from './modules/API'; -export keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut'; -export remoteControl from './modules/remotecontrol/RemoteControl'; -export settings from './modules/settings/Settings'; -export translation from './modules/translation/translation'; -export UI from './modules/UI/UI'; +import conference from './conference'; +import API from './modules/API'; +import keyboardshortcut from './modules/keyboardshortcut/keyboardshortcut'; +import remoteControl from './modules/remotecontrol/RemoteControl'; +import settings from './modules/settings/Settings'; +import translation from './modules/translation/translation'; +import UI from './modules/UI/UI'; -// Used by do_external_connect.js if we receive the attach data after connect -// was already executed. status property can be 'initialized', 'ready', or -// 'connecting'. We are interested in 'ready' status only which means that -// connect was executed but we have to wait for the attach data. In status -// 'ready' handler property will be set to a function that will finish the -// connect process when the attach data or error is received. -export const connect = { - handler: null, - status: 'initialized' -}; +window.APP = { + API, + conference, -// Used for automated performance tests -export const connectionTimes = { - 'index.loaded': window.indexLoadedTime + // Used by do_external_connect.js if we receive the attach data after + // connect was already executed. status property can be 'initialized', + // 'ready', or 'connecting'. We are interested in 'ready' status only which + // means that connect was executed but we have to wait for the attach data. + // In status 'ready' handler property will be set to a function that will + // finish the connect process when the attach data or error is received. + connect: { + handler: null, + status: 'initialized' + }, + + // Used for automated performance tests. + connectionTimes: { + 'index.loaded': window.indexLoadedTime + }, + + keyboardshortcut, + remoteControl, + settings, + translation, + UI }; // TODO The execution of the mobile app starts from react/index.native.js. diff --git a/webpack.config.js b/webpack.config.js index b7ef402f0..535a4d9de 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -147,7 +147,6 @@ const config = { }, output: { filename: `[name]${minimize ? '.min' : ''}.js`, - libraryTarget: 'umd', path: `${__dirname}/build`, publicPath: '/libs/', sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map` @@ -175,36 +174,19 @@ const config = { } }; -const configs = [ - - // The Webpack configuration to bundle app.bundle.js (aka APP). +module.exports = [ Object.assign({}, config, { entry: { 'app.bundle': [ + // XXX Required by at least IE11 at the time of this writing. 'babel-polyfill', './app.js' - ] - }, - output: Object.assign({}, config.output, { - library: 'APP' - }) - }), + ], - // The Webpack configuration to bundle device_selection_popup_bundle.js - // (i.e. js file for the device selection popup dialog). - Object.assign({}, config, { - entry: { 'device_selection_popup_bundle': - './react/features/device-selection/popup.js' - } - }), + './react/features/device-selection/popup.js', - // The Webpack configuration to bundle do_external_connect.js (which - // attempts to optimize Jitsi Meet's XMPP connection and, consequently, is - // also known as HTTP pre-bind). - Object.assign({}, config, { - entry: { 'do_external_connect': './connection_optimization/do_external_connect.js' } @@ -217,13 +199,12 @@ const configs = [ 'external_api': './modules/API/external/index.js' }, output: Object.assign({}, config.output, { - library: 'JitsiMeetExternalAPI' + library: 'JitsiMeetExternalAPI', + libraryTarget: 'umd' }) }) ]; -module.exports = configs; - /** * Determines whether a specific (HTTP) request is to bypass the proxy of * webpack-dev-server (i.e. is to be handled by the proxy target) and, if not,