Optimize React in production
This commit is contained in:
parent
c3428e8213
commit
06d2fb0aca
|
@ -4,13 +4,28 @@ require('babel-polyfill'); // Define Object.assign() from ES6 in ES5.
|
||||||
|
|
||||||
var HasteResolverPlugin = require('haste-resolver-webpack-plugin');
|
var HasteResolverPlugin = require('haste-resolver-webpack-plugin');
|
||||||
var process = require('process');
|
var process = require('process');
|
||||||
|
var webpack = require('webpack');
|
||||||
|
|
||||||
var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
|
var aui_css = __dirname + '/node_modules/@atlassian/aui/dist/aui/css/';
|
||||||
var minimize
|
var minimize
|
||||||
= process.argv.indexOf('-p') != -1
|
= process.argv.indexOf('-p') != -1
|
||||||
|| process.argv.indexOf('--optimize-minimize') != -1;
|
|| process.argv.indexOf('--optimize-minimize') != -1;
|
||||||
|
var plugins = [
|
||||||
|
new HasteResolverPlugin()
|
||||||
|
];
|
||||||
var strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
|
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
|
// The base Webpack configuration to bundle the JavaScript artifacts of
|
||||||
// jitsi-meet such as app.bundle.js and external_api.js.
|
// jitsi-meet such as app.bundle.js and external_api.js.
|
||||||
var config = {
|
var config = {
|
||||||
|
@ -87,9 +102,7 @@ var config = {
|
||||||
path: __dirname + '/build',
|
path: __dirname + '/build',
|
||||||
sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
|
sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: plugins,
|
||||||
new HasteResolverPlugin()
|
|
||||||
],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
aui:
|
aui:
|
||||||
|
|
Loading…
Reference in New Issue