From 0532c9c37bf5e881671275f194df0b8faadf1ec1 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Thu, 15 Apr 2021 15:17:24 +0100 Subject: [PATCH] Use React production for CI builds When running Nightly build we want to benefit from the fast runtime that React production offers and get rid of the runtime overhead that comes with development. We are setting NODE_ENV and not "webpack.mode" to not loose sourcemaps and have minified sources in that environment --- webpack.config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index cf1db3f981..a3d067d5a5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -18,6 +18,20 @@ module.exports = (env, argv) => { // We override this via environment variable to avoid duplicating the scripts // in `package.json` just for a different mode. argv.mode = "development"; + + // More and more people are using nightly build as their main client + // Libraries like React have a development build that is useful + // when working on the app but adds significant runtime overhead + // We want to use the React production build but not compile the whole + // application to productions standards + additionalPlugins.concat([ + new webpack.EnvironmentPlugin({ + "NODE_ENV": "production", + }), + new webpack.DefinePlugin({ + "process.env.NODE_ENV": "production", + }), + ]); } const development = {};