Skip to content

Commit

Permalink
feat(gatsby): use production React for dev-ssr when CI=true (#28728) (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
GatsbyJS Bot and KyleAMathews authored Dec 29, 2020
1 parent 12a78af commit ad8e4cb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
@@ -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`)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ad8e4cb

Please sign in to comment.