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)