Skip to content

Commit

Permalink
Server: Use production react in the server bundle for prod
Browse files Browse the repository at this point in the history
See https://twitter.com/eldh/status/821257104694579200

Currently we're running the debug build of react in our server process. This should switch it to be the production build, which should cut down render times a fair bit.
  • Loading branch information
blowery committed Jan 17, 2017
1 parent 7d16df2 commit 3e8b929
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions webpack.config.node.js
Expand Up @@ -13,6 +13,8 @@ var webpack = require( 'webpack' ),
*/
var config = require( 'config' );

const bundleEnv = config( 'env' );

/**
* This lists modules that must use commonJS `require()`s
* All modules listed here need to be ES5.
Expand Down Expand Up @@ -68,10 +70,12 @@ var webpackConfig = {
exclude: /(node_modules|devdocs\/search-index)/,
loader: 'babel',
query: {
plugins: [ [
path.join( __dirname, 'server', 'bundler', 'babel', 'babel-plugin-transform-wpcalypso-async' ),
{ async: false }
] ]
plugins: [
[
path.join( __dirname, 'server', 'bundler', 'babel', 'babel-plugin-transform-wpcalypso-async' ),
{ async: false }
]
]
}
},
{
Expand All @@ -93,6 +97,11 @@ var webpackConfig = {
__dirname: true
},
plugins: [
new webpack.DefinePlugin( {
'process.env': {
NODE_ENV: JSON.stringify( bundleEnv )
}
} ),
// Require source-map-support at the top, so we get source maps for the bundle
new webpack.BannerPlugin( 'require( "source-map-support" ).install();', { raw: true, entryOnly: false } ),
new webpack.NormalModuleReplacementPlugin( /^lib\/analytics$/, 'lodash/noop' ), // Depends on BOM
Expand Down

0 comments on commit 3e8b929

Please sign in to comment.