Lyubo Marinov пре 8 година
родитељ
комит
f200b17a33
2 измењених фајлова са 47 додато и 34 уклоњено
  1. 2
    4
      package.json
  2. 45
    30
      webpack.config.js

+ 2
- 4
package.json Прегледај датотеку

84
     "expose-loader": "0.7.3",
84
     "expose-loader": "0.7.3",
85
     "file-loader": "0.11.1",
85
     "file-loader": "0.11.1",
86
     "flow-bin": "0.38.0",
86
     "flow-bin": "0.38.0",
87
-    "haste-resolver-webpack-plugin": "0.2.2",
88
     "imports-loader": "0.7.1",
87
     "imports-loader": "0.7.1",
89
     "jshint": "2.9.4",
88
     "jshint": "2.9.4",
90
-    "json-loader": "0.5.4",
91
     "node-sass": "3.13.1",
89
     "node-sass": "3.13.1",
92
     "precommit-hook": "3.0.0",
90
     "precommit-hook": "3.0.0",
93
     "string-replace-loader": "1.2.0",
91
     "string-replace-loader": "1.2.0",
94
     "style-loader": "0.18.1",
92
     "style-loader": "0.18.1",
95
-    "webpack": "1.14.0",
96
-    "webpack-dev-server": "1.16.3"
93
+    "webpack": "2.6.1",
94
+    "webpack-dev-server": "2.4.5"
97
   },
95
   },
98
   "license": "Apache-2.0",
96
   "license": "Apache-2.0",
99
   "scripts": {
97
   "scripts": {

+ 45
- 30
webpack.config.js Прегледај датотеку

1
 /* global __dirname */
1
 /* global __dirname */
2
 
2
 
3
-const HasteResolverPlugin = require('haste-resolver-webpack-plugin');
4
 const process = require('process');
3
 const process = require('process');
5
 const webpack = require('webpack');
4
 const webpack = require('webpack');
6
 
5
 
18
         || process.argv.indexOf('--optimize-minimize') !== -1;
17
         || process.argv.indexOf('--optimize-minimize') !== -1;
19
 const node_modules = __dirname + '/node_modules/';
18
 const node_modules = __dirname + '/node_modules/';
20
 const plugins = [
19
 const plugins = [
21
-    new HasteResolverPlugin()
20
+    new webpack.LoaderOptionsPlugin({
21
+        debug: !minimize,
22
+        minimize: minimize
23
+    })
22
 ];
24
 ];
23
 const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
25
 const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
24
 
26
 
43
             // webpack 2.
45
             // webpack 2.
44
             warnings: true
46
             warnings: true
45
         },
47
         },
48
+        extractComments: true,
46
 
49
 
47
         // Use the source map to map error message locations to modules. The
50
         // Use the source map to map error message locations to modules. The
48
         // default is false in webpack 2.
51
         // default is false in webpack 2.
66
     },
69
     },
67
     devtool: 'source-map',
70
     devtool: 'source-map',
68
     module: {
71
     module: {
69
-        loaders: [ {
72
+        rules: [ {
70
             // Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
73
             // Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React
71
             // as well.
74
             // as well.
72
 
75
 
73
             exclude: node_modules,
76
             exclude: node_modules,
74
             loader: 'babel-loader',
77
             loader: 'babel-loader',
75
-            query: {
78
+            options: {
76
                 // XXX The require.resolve bellow solves failures to locate the
79
                 // XXX The require.resolve bellow solves failures to locate the
77
                 // presets when lib-jitsi-meet, for example, is npm linked in
80
                 // presets when lib-jitsi-meet, for example, is npm linked in
78
                 // jitsi-meet. The require.resolve, of course, mandates the use
81
                 // jitsi-meet. The require.resolve, of course, mandates the use
79
                 // of the prefix babel-preset- in the preset names.
82
                 // of the prefix babel-preset- in the preset names.
80
                 presets: [
83
                 presets: [
81
-                    'babel-preset-es2015',
82
-                    'babel-preset-react',
83
-                    'babel-preset-stage-1'
84
-                ].map(require.resolve)
84
+                    [
85
+                        require.resolve('babel-preset-es2015'),
86
+
87
+                        // Tell babel to avoid compiling imports into CommonJS
88
+                        // so that webpack may do tree shaking.
89
+                        { modules: false }
90
+                    ],
91
+                    require.resolve('babel-preset-react'),
92
+                    require.resolve('babel-preset-stage-1')
93
+                ]
85
             },
94
             },
86
             test: /\.jsx?$/
95
             test: /\.jsx?$/
87
         }, {
96
         }, {
105
         }, {
114
         }, {
106
             // Allow CSS to be imported into JavaScript.
115
             // Allow CSS to be imported into JavaScript.
107
 
116
 
108
-            loaders: [
117
+            test: /\.css$/,
118
+            use: [
109
                 'style-loader',
119
                 'style-loader',
110
                 'css-loader'
120
                 'css-loader'
111
-            ],
112
-            test: /\.css$/
121
+            ]
113
         }, {
122
         }, {
114
             // Emit the static assets of AUI such as images that are referenced
123
             // Emit the static assets of AUI such as images that are referenced
115
             // by CSS into the output path.
124
             // by CSS into the output path.
116
 
125
 
117
             include: aui_css,
126
             include: aui_css,
118
             loader: 'file-loader',
127
             loader: 'file-loader',
119
-            query: {
128
+            options: {
120
                 context: aui_css,
129
                 context: aui_css,
121
                 name: '[path][name].[ext]'
130
                 name: '[path][name].[ext]'
122
             },
131
             },
123
             test: /\.(gif|png|svg)$/
132
             test: /\.(gif|png|svg)$/
124
-        }, {
125
-            // Enable the import of JSON files.
126
-
127
-            loader: 'json-loader',
128
-            exclude: node_modules,
129
-            test: /\.json$/
130
         } ],
133
         } ],
131
         noParse: [
134
         noParse: [
132
 
135
 
154
         alias: {
157
         alias: {
155
             jquery: 'jquery/dist/jquery' + (minimize ? '.min' : '') + '.js'
158
             jquery: 'jquery/dist/jquery' + (minimize ? '.min' : '') + '.js'
156
         },
159
         },
157
-        packageAlias: 'browser'
160
+        aliasFields: [
161
+            'browser'
162
+        ],
163
+        extensions: [
164
+            // 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
+            // non-default extension we have is .web.js, drop
167
+            // haste-resolver-webpack-plugin and go with resolve.extensions.
168
+            '.web.js',
169
+
170
+            // Webpack defaults:
171
+            '.js',
172
+            '.json'
173
+        ]
158
     }
174
     }
159
 };
175
 };
160
 
176
 
164
     Object.assign({}, config, {
180
     Object.assign({}, config, {
165
         entry: {
181
         entry: {
166
             'app.bundle': [
182
             'app.bundle': [
167
-                // XXX Requried by at least IE11 at the time of this writing.
183
+                // XXX Required by at least IE11 at the time of this writing.
168
                 'babel-polyfill',
184
                 'babel-polyfill',
169
                 './app.js'
185
                 './app.js'
170
             ]
186
             ]
174
         })
190
         })
175
     }),
191
     }),
176
 
192
 
193
+    // The Webpack configuration to bundle device_selection_popup_bundle.js
194
+    // (i.e. js file for the device selection popup dialog).
195
+    Object.assign({}, config, {
196
+        entry: {
197
+            'device_selection_popup_bundle':
198
+                './react/features/device-selection/popup.js'
199
+        }
200
+    }),
201
+
177
     // The Webpack configuration to bundle do_external_connect.js (which
202
     // The Webpack configuration to bundle do_external_connect.js (which
178
     // attempts to optimize Jitsi Meet's XMPP connection and, consequently, is
203
     // attempts to optimize Jitsi Meet's XMPP connection and, consequently, is
179
     // also known as HTTP pre-bind).
204
     // also known as HTTP pre-bind).
193
         output: Object.assign({}, config.output, {
218
         output: Object.assign({}, config.output, {
194
             library: 'JitsiMeetExternalAPI'
219
             library: 'JitsiMeetExternalAPI'
195
         })
220
         })
196
-    }),
197
-
198
-    // The Webpack configuration to bundle popup_bundle.js (js file for the
199
-    // device selection popup dialog).
200
-    Object.assign({}, config, {
201
-        entry: {
202
-            'device_selection_popup_bundle':
203
-                './react/features/device-selection/popup.js'
204
-        },
205
-        output: config.output
206
     })
221
     })
207
 ];
222
 ];
208
 
223
 

Loading…
Откажи
Сачувај