Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to React Hot Loader v4 #4500

Merged
merged 1 commit into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Migrate to React Hot Loader v4
  • Loading branch information
Noé Lebrun committed Mar 13, 2018
commit 50c533b70a7872094b6096252e5a8534ff0efa46
23 changes: 1 addition & 22 deletions packages/gatsby/cache-dir/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react"
import ReactDOM from "react-dom"
import { AppContainer as HotContainer } from "react-hot-loader"
import domReady from "domready"

import socketIo from "./socketIo"
Expand Down Expand Up @@ -39,33 +38,13 @@ apiRunnerAsync(`onClientEntry`).then(() => {

domReady(() =>
ReactDOM.render(
<HotContainer>
<Root />
</HotContainer>,
<Root />,
rootElement,
() => {
apiRunner(`onInitialClientRender`)
}
)
)

if (module.hot) {
module.hot.accept(`./root`, () => {
let NextRoot = require(`./root`)
if (NextRoot.default) {
NextRoot = NextRoot.default
}
ReactDOM.render(
<HotContainer>
<NextRoot />
</HotContainer>,
rootElement,
() => {
apiRunner(`onInitialClientRender`)
}
)
})
}
})

function supportsServiceWorkers(location, navigator) {
Expand Down
3 changes: 2 additions & 1 deletion packages/gatsby/cache-dir/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import pages from "./pages.json"
import redirects from "./redirects.json"
import ComponentRenderer from "./component-renderer"
import loader from "./loader"
import { hot } from "react-hot-loader"

import * as ErrorOverlay from "react-error-overlay"

Expand Down Expand Up @@ -198,4 +199,4 @@ const Root = () =>
// Let site, plugins wrap the site e.g. for Redux.
const WrappedRoot = apiRunner(`wrapRootComponent`, { Root }, Root)[0]

export default WrappedRoot
export default hot(module)(WrappedRoot)
2 changes: 1 addition & 1 deletion packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"raw-loader": "^0.5.1",
"react-dev-utils": "^4.2.1",
"react-error-overlay": "^3.0.0",
"react-hot-loader": "^3.0.0-beta.6",
"react-hot-loader": "^4.0.0",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"redux": "^3.6.0",
Expand Down
1 change: 0 additions & 1 deletion packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ module.exports = async (
case `develop`:
return {
commons: [
require.resolve(`react-hot-loader/patch`),
`${require.resolve(`webpack-hot-middleware/client`)}?path=http://${
program.host
}:${webpackPort}/__webpack_hmr&reload=true&overlay=false`,
Expand Down
63 changes: 14 additions & 49 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4713,12 +4713,6 @@ error-ex@^1.2.0, error-ex@^1.3.1:
dependencies:
is-arrayish "^0.2.1"

error-stack-parser@^1.3.6:
version "1.3.6"
resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-1.3.6.tgz#e0e73b93e417138d1cd7c0b746b1a4a14854c292"
dependencies:
stackframe "^0.3.1"

error-stack-parser@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.1.tgz#a3202b8fb03114aa9b40a0e3669e48b2b65a010a"
Expand Down Expand Up @@ -5334,7 +5328,7 @@ fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"

fast-levenshtein@~2.0.4:
fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.4:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"

Expand Down Expand Up @@ -6620,7 +6614,7 @@ hoist-non-react-statics@^1.0.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb"

hoist-non-react-statics@^2.1.0, hoist-non-react-statics@^2.3.0:
hoist-non-react-statics@^2.1.0, hoist-non-react-statics@^2.3.0, hoist-non-react-statics@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz#d2ca2dfc19c5a91c5a6615ce8e564ef0347e2a40"

Expand Down Expand Up @@ -8609,7 +8603,7 @@ lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"

lodash@4, lodash@^4.0.0, lodash@^4.11.1, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.1, lodash@^4.8.0, lodash@~4.17.4:
lodash@4, lodash@^4.0.0, lodash@^4.11.1, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.8.0, lodash@~4.17.4:
version "4.17.5"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"

Expand Down Expand Up @@ -11329,10 +11323,6 @@ react-datetime@^2.11.0:
prop-types "^15.5.7"
react-onclickoutside "^6.5.0"

react-deep-force-update@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/react-deep-force-update/-/react-deep-force-update-2.1.1.tgz#8ea4263cd6455a050b37445b3f08fd839d86e909"

react-dev-utils@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-4.2.1.tgz#9f2763e7bafa1a1b9c52254d2a479deec280f111"
Expand Down Expand Up @@ -11402,15 +11392,15 @@ react-frame-component@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/react-frame-component/-/react-frame-component-2.0.2.tgz#e602a980e1d78f91f471531225b61cfdbf68e614"

react-hot-loader@^3.0.0-beta.6:
version "3.1.3"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-3.1.3.tgz#6f92877326958c7cb0134b512474517869126082"
react-hot-loader@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.0.0.tgz#3452fa9bc0d0ba9dfc5b0ccfa25101ca8dbd2de2"
dependencies:
fast-levenshtein "^2.0.6"
global "^4.3.0"
react-deep-force-update "^2.1.1"
react-proxy "^3.0.0-alpha.0"
redbox-react "^1.3.6"
source-map "^0.6.1"
hoist-non-react-statics "^2.5.0"
prop-types "^15.6.0"
shallowequal "^1.0.2"

react-immutable-proptypes@^2.1.0:
version "2.1.0"
Expand All @@ -11434,12 +11424,6 @@ react-portal@^3.1.0:
dependencies:
prop-types "^15.5.8"

react-proxy@^3.0.0-alpha.0:
version "3.0.0-alpha.1"
resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-3.0.0-alpha.1.tgz#4400426bcfa80caa6724c7755695315209fa4b07"
dependencies:
lodash "^4.6.1"

react-redux@^4.0.0, react-redux@^4.4.0:
version "4.4.8"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-4.4.8.tgz#e7bc1dd100e8b64e96ac8212db113239b9e2e08f"
Expand Down Expand Up @@ -11772,15 +11756,6 @@ recursive-readdir@2.2.1:
dependencies:
minimatch "3.0.3"

redbox-react@^1.3.6:
version "1.5.0"
resolved "https://registry.yarnpkg.com/redbox-react/-/redbox-react-1.5.0.tgz#04dab11557d26651bf3562a67c22ace56c5d3967"
dependencies:
error-stack-parser "^1.3.6"
object-assign "^4.0.1"
prop-types "^15.5.4"
sourcemapped-stacktrace "^1.1.6"

redent@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde"
Expand Down Expand Up @@ -12976,6 +12951,10 @@ shallow-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.0.0.tgz#508d1838b3de590ab8757b011b25e430900945f7"

shallowequal@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.0.2.tgz#1561dbdefb8c01408100319085764da3fcf83f8f"

sharp@^0.20.0:
version "0.20.0"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.20.0.tgz#2ff9f1ae11f068ce7d7591f531cad52c7821d033"
Expand Down Expand Up @@ -13349,10 +13328,6 @@ source-map@0.1.x:
dependencies:
amdefine ">=0.0.4"

source-map@0.5.6:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"

source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, source-map@~0.5.3, source-map@~0.5.6:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
Expand All @@ -13367,12 +13342,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

sourcemapped-stacktrace@^1.1.6:
version "1.1.8"
resolved "https://registry.yarnpkg.com/sourcemapped-stacktrace/-/sourcemapped-stacktrace-1.1.8.tgz#6b7a3f1a6fb15f6d40e701e23ce404553480d688"
dependencies:
source-map "0.5.6"

space-separated-tokens@^1.0.0, space-separated-tokens@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-1.1.1.tgz#9695b9df9e65aec1811d4c3f9ce52520bc2f7e4d"
Expand Down Expand Up @@ -13519,10 +13488,6 @@ stack-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620"

stackframe@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-0.3.1.tgz#33aa84f1177a5548c8935533cbfeb3420975f5a4"

stackframe@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.0.4.tgz#357b24a992f9427cba6b545d96a14ed2cbca187b"
Expand Down