Преглед на файлове

Increase ES6 utilization in webpack.config.js

master
Lyubo Marinov преди 8 години
родител
ревизия
0d7aea377a
променени са 1 файла, в които са добавени 17 реда и са изтрити 15 реда
  1. 17
    15
      webpack.config.js

+ 17
- 15
webpack.config.js Целия файл

3
 const process = require('process');
3
 const process = require('process');
4
 const webpack = require('webpack');
4
 const webpack = require('webpack');
5
 
5
 
6
-const aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
6
+const aui_css = `${__dirname}/node_modules/@atlassian/aui/dist/aui/css/`;
7
 
7
 
8
 /**
8
 /**
9
  * The URL of the Jitsi Meet deployment to be proxy to in the context of
9
  * The URL of the Jitsi Meet deployment to be proxy to in the context of
15
 const minimize
15
 const minimize
16
     = process.argv.indexOf('-p') !== -1
16
     = process.argv.indexOf('-p') !== -1
17
         || process.argv.indexOf('--optimize-minimize') !== -1;
17
         || process.argv.indexOf('--optimize-minimize') !== -1;
18
-const node_modules = __dirname + '/node_modules/';
18
+const node_modules = `${__dirname}/node_modules/`;
19
 const plugins = [
19
 const plugins = [
20
     new webpack.LoaderOptionsPlugin({
20
     new webpack.LoaderOptionsPlugin({
21
         debug: !minimize,
21
         debug: !minimize,
22
-        minimize: minimize
22
+        minimize
23
     })
23
     })
24
 ];
24
 ];
25
 const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
25
 const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
146
         __filename: true
146
         __filename: true
147
     },
147
     },
148
     output: {
148
     output: {
149
-        filename: '[name]' + (minimize ? '.min' : '') + '.js',
149
+        filename: `[name]${minimize ? '.min' : ''}.js`,
150
         libraryTarget: 'umd',
150
         libraryTarget: 'umd',
151
-        path: __dirname + '/build',
151
+        path: `${__dirname}/build`,
152
         publicPath: '/libs/',
152
         publicPath: '/libs/',
153
-        sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
153
+        sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
154
     },
154
     },
155
-    plugins: plugins,
155
+    plugins,
156
     resolve: {
156
     resolve: {
157
         alias: {
157
         alias: {
158
-            jquery: 'jquery/dist/jquery' + (minimize ? '.min' : '') + '.js'
158
+            jquery: `jquery/dist/jquery${minimize ? '.min' : ''}.js`
159
         },
159
         },
160
         aliasFields: [
160
         aliasFields: [
161
             'browser'
161
             'browser'
162
         ],
162
         ],
163
         extensions: [
163
         extensions: [
164
+
164
             // Webpack 2 broke haste-resolver-webpack-plugin and I could not fix
165
             // 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
             // it. But given that there is resolve.extensions and the only
166
             // non-default extension we have is .web.js, drop
167
             // non-default extension we have is .web.js, drop
232
  * @returns {string|undefined} If the request is to be served by the proxy
233
  * @returns {string|undefined} If the request is to be served by the proxy
233
  * target, undefined; otherwise, the path to the local file to be served.
234
  * target, undefined; otherwise, the path to the local file to be served.
234
  */
235
  */
235
-function devServerProxyBypass(request) {
236
-    let path = request.path;
237
-
236
+function devServerProxyBypass({ path }) {
238
     // Use local files from the css and libs directories.
237
     // Use local files from the css and libs directories.
239
     if (path.startsWith('/css/')) {
238
     if (path.startsWith('/css/')) {
240
         return path;
239
         return path;
241
     }
240
     }
242
-    if (configs.some(function (c) {
241
+
242
+    const configs = module.exports;
243
+
244
+    if ((Array.isArray(configs) ? configs : Array(configs)).some(c => {
243
                 if (path.startsWith(c.output.publicPath)) {
245
                 if (path.startsWith(c.output.publicPath)) {
244
                     if (!minimize) {
246
                     if (!minimize) {
245
                         // Since webpack-dev-server is serving non-minimized
247
                         // Since webpack-dev-server is serving non-minimized
246
                         // artifacts, serve them even if the minimized ones are
248
                         // artifacts, serve them even if the minimized ones are
247
                         // requested.
249
                         // requested.
248
-                        Object.keys(c.entry).some(function (e) {
249
-                            var name = e + '.min.js';
250
+                        Object.keys(c.entry).some(e => {
251
+                            const name = `${e}.min.js`;
250
 
252
 
251
                             if (path.indexOf(name) !== -1) {
253
                             if (path.indexOf(name) !== -1) {
252
-                                path = path.replace(name, e + '.js');
254
+                                path = path.replace(name, `${e}.js`);
253
 
255
 
254
                                 return true;
256
                                 return true;
255
                             }
257
                             }

Loading…
Отказ
Запис