From ad8e4cb1b388e2c36dc2a0d376e96e0122bc04df Mon Sep 17 00:00:00 2001 From: GatsbyJS Bot Date: Tue, 29 Dec 2020 16:26:32 -0500 Subject: [PATCH] feat(gatsby): use production React for dev-ssr when CI=true (#28728) (#28792) * feat(gatsby): use production React for dev-ssr when CI=true * Use @pieh's suggestion for switching to the prod versions of React/ReactDOM * Don't need this now (cherry picked from commit bd6b899fdb22748c2ecc016643ed39e32d014a6b) Co-authored-by: Kyle Mathews --- packages/gatsby/src/utils/webpack.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 70025f7c81068..68a5a6ecd1d7c 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -1,5 +1,6 @@ require(`v8-compile-cache`) +const { isCI } = require(`gatsby-core-utils`) const crypto = require(`crypto`) const fs = require(`fs-extra`) const path = require(`path`) @@ -675,6 +676,23 @@ module.exports = async ( config.externals = [ function (context, request, callback) { + if ( + stage === `develop-html` && + isCI() && + process.env.GATSBY_EXPERIMENTAL_DEV_SSR + ) { + if (request === `react`) { + callback(null, `react/cjs/react.production.min.js`) + return + } else if (request === `react-dom/server`) { + callback( + null, + `react-dom/cjs/react-dom-server.node.production.min.js` + ) + return + } + } + const external = isExternal(request) if (external !== null) { callback(null, external)