Optimize React in production

This commit is contained in:
Ilya Daynatovich 2016-11-23 23:18:24 -06:00 committed by Lyubomir Marinov
parent c3428e8213
commit 06d2fb0aca
1 changed files with 16 additions and 3 deletions

View File

@ -4,13 +4,28 @@ require('babel-polyfill'); // Define Object.assign() from ES6 in ES5.
var HasteResolverPlugin = require('haste-resolver-webpack-plugin');
var process = require('process');
var webpack = require('webpack');
var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
var minimize
= process.argv.indexOf('-p') != -1
|| process.argv.indexOf('--optimize-minimize') != -1;
var plugins = [
new HasteResolverPlugin()
];
var strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
if (minimize) {
// XXX Webpack's command line argument -p is not enough. Further
// optimizations are made possible by the use of DefinePlugin and NODE_ENV
// with value 'production'. For example, React takes advantage of these.
plugins.push(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}));
}
// The base Webpack configuration to bundle the JavaScript artifacts of
// jitsi-meet such as app.bundle.js and external_api.js.
var config = {
@ -87,9 +102,7 @@ var config = {
path: __dirname + '/build',
sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
},
plugins: [
new HasteResolverPlugin()
],
plugins: plugins,
resolve: {
alias: {
aui: