Skip to content

Commit ad8e4cb

Browse files
GatsbyJS BotKyleAMathews
GatsbyJS Bot
andauthored
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 bd6b899) Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
1 parent 12a78af commit ad8e4cb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/gatsby/src/utils/webpack.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require(`v8-compile-cache`)
22

3+
const { isCI } = require(`gatsby-core-utils`)
34
const crypto = require(`crypto`)
45
const fs = require(`fs-extra`)
56
const path = require(`path`)
@@ -675,6 +676,23 @@ module.exports = async (
675676

676677
config.externals = [
677678
function (context, request, callback) {
679+
if (
680+
stage === `develop-html` &&
681+
isCI() &&
682+
process.env.GATSBY_EXPERIMENTAL_DEV_SSR
683+
) {
684+
if (request === `react`) {
685+
callback(null, `react/cjs/react.production.min.js`)
686+
return
687+
} else if (request === `react-dom/server`) {
688+
callback(
689+
null,
690+
`react-dom/cjs/react-dom-server.node.production.min.js`
691+
)
692+
return
693+
}
694+
}
695+
678696
const external = isExternal(request)
679697
if (external !== null) {
680698
callback(null, external)

0 commit comments

Comments
 (0)