Commit 2f3626f0 authored by Jure's avatar Jure

Merge branch 'make_hot_reloading_work' into 'master'

fix: change/update HMR use

See merge request pubsweet/pubsweet-starter!45
parents 7ff5635e 8161761b
Pipeline #6660 failed with stages
in 8 seconds
......@@ -12,7 +12,7 @@ stages:
- demo
build:
image: docker:latest
image: docker:stable
stage: build
script:
- docker version
......
......@@ -5,6 +5,7 @@ RUN curl -sL http://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
RUN echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google.list
RUN apt-get update && apt-get install -y google-chrome-stable
# Apparently no debian package for firefox 57
RUN apt-get install -y libdbus-glib-1-2
RUN cd /opt && wget http://ftp.mozilla.org/pub/firefox/releases/57.0.4/linux-x86_64/en-GB/firefox-57.0.4.tar.bz2 && \
tar xjf firefox-*.tar.bz2 && \
ln -s /opt/firefox/firefox /usr/local/bin/
......
......@@ -2,12 +2,12 @@ import 'regenerator-runtime/runtime'
import React from 'react'
import ReactDOM from 'react-dom'
import { hot } from 'react-hot-loader'
import { configureStore, Root } from 'pubsweet-client'
import theme from '@pubsweet/default-theme'
import { AppContainer } from 'react-hot-loader'
import createHistory from 'history/createBrowserHistory'
import routes from './routes'
......@@ -17,22 +17,8 @@ const store = configureStore(history, {})
const rootEl = document.getElementById('root')
ReactDOM.render(
<AppContainer>
<Root history={history} routes={routes} store={store} theme={theme} />
</AppContainer>,
<Root history={history} routes={routes} store={store} theme={theme} />,
rootEl,
)
if (module.hot) {
module.hot.accept('pubsweet-client/src/components/Root', () => {
// eslint-disable-next-line global-require
const NextRoot = require('pubsweet-client/src/components/Root').default
ReactDOM.render(
<AppContainer>
<NextRoot history={history} routes={routes} store={store} />
</AppContainer>,
rootEl,
)
})
}
export default hot(module)(Root)
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment