Skip to content
This repository has been archived by the owner on Dec 8, 2019. It is now read-only.

Commit

Permalink
Integrated latest react-hot-loader 3.0.0 beta 6 (not hot reloading)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sawtaytoes committed Nov 18, 2016
1 parent 8014352 commit c675c42
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
4 changes: 3 additions & 1 deletion includes/webpack-dev-client-config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ happyThreadPool = HappyPack.ThreadPool size: 4
webpackConfig =
entry:
main: [
'react-hot-loader/patch'
'webpack-dev-server/client?' + config.getServerUrl()
'webpack/hot/dev-server'
'./' + paths.code.src + 'client'
]
tests: [
'react-hot-loader/patch'
'webpack-dev-server/client?' + config.getServerUrl()
'webpack/hot/dev-server'
'./' + paths.code.src + 'tests'
Expand Down Expand Up @@ -44,7 +46,7 @@ webpackConfig =
new webpack.DefinePlugin 'process.env.NODE_ENV': JSON.stringify config.getEnv()
new HappyPack
id: 'jsx', threadPool: happyThreadPool, loaders: [
'react-hot'
'react-hot-loader/webpack'
'babel'
]
new HappyPack
Expand Down
26 changes: 20 additions & 6 deletions src/code/client.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React from 'react'
import { render } from 'react-dom'
import { match, browserHistory, Router, Route, Redirect, Link } from 'react-router'
import { Provider } from 'react-redux'
import { match } from 'react-router'
import { AppContainer } from 'react-hot-loader'

// Root Component
import Root from 'root'

// Polyfills
import 'react-fastclick'
import 'utilities/polyfills'

// Store and Routes
import { history, store } from 'utilities/store'
import { history } from 'utilities/store'
import routes from './routes'

// Router
Expand All @@ -18,8 +21,19 @@ match({ history, routes }, (error, redirectLocation, renderProps) => {
}

render(
<Provider store={store}>
<Router history={browserHistory} {...renderProps} />
</Provider>
<AppContainer>
<Root renderProps={renderProps} />
</AppContainer>
, document.getElementById('root'))

if (module.hot) {
module.hot.accept('./root', () => {
const RootContainer = require('./root').default
render(
<AppContainer>
<RootContainer renderProps={renderProps} />
</AppContainer>
, document.getElementById('root'))
})
}
})
14 changes: 14 additions & 0 deletions src/code/root.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { Component } from 'react'
import { Provider } from 'react-redux'
import { browserHistory, Router } from 'react-router'

// Store and Routes
import { store } from 'utilities/store'

export default class Root extends Component {
render() { return (
<Provider store={store}>
<Router history={browserHistory} {...this.props.renderProps} />
</Provider>
)}
}

0 comments on commit c675c42

Please sign in to comment.